Mega Code Archive

 
Categories / Delphi / VCL
 

Font Selector Component

Title: Font Selector Component Question: Font Selector Answer: ////////////////////// // Font Selector // ////////////////////// unit FontSel; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TFontSel = class(TComboBox) private { Private declarations } protected { Protected declarations } public constructor Create (AOwner: TComponent); override; procedure CreateWnd; override; published property Style default csDropDownList; property Items stored False; end; procedure Register; implementation procedure Register; begin RegisterComponents('Venom Team', [TFontSel]); end; constructor TFontSel.Create (AOwner: TComponent); begin inherited Create (AOwner); Style := csDropDownList; end; procedure TFontSel.CreateWnd; begin inherited CreateWnd; Items.Assign (Screen.Fonts); end; end. { Usage Example } // procedure TForm1.Button1Click(Sender: TObject); // begin // Memo1.Font.Name := FontSel1.Text; // end; // end.