ListBOX控件

来源:百度知道 编辑:UC知道 时间:2024/06/03 12:52:48
在窗口上有个listbox控件,怎么让list控件中显示当前系统的所有字体?
Dim i As Integer
For i = 0 To Screen.FontCount - 1
List1.AddItem Screen.Fonts(i)

Next i

就这么简单,请问楼下的发这么多,复制的吗?

unit Fontlist;

interface

uses Windows, Classes, Graphics, Forms, Controls, StdCtrls;

type
TForm1 = class(TForm)
ListBox1: TListBox;
Label1: TLabel;
FontLabel: TLabel;
procedure FormCreate(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure DrawItem(Control: TWinControl; Index: Integer; Rect: TRect;
State: TOwnerDrawState);
procedure ListBox1MeasureItem(Control: TWinControl; Index: Integer;
var Height: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
Listbox1.Items := Screen.Fonts;
end;

procedure TForm1.ListBox1Click(Sender: TObject);
begin
FontLabel.Caption := ListBox1.Items[ListBox1.ItemIn