이 및에 {} 바로 밑에부터 아시는 분은 설명좀 해주세요
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
procedure ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{ 이부분 좀 설명해주세요 }
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
with TListBox(Control).Canvas do begin
if Index = 2 then begin
Brush.Color := clRed;
Font.Color := clBlue;
end;
FillRect(Rect);
TextRect(Rect, Rect.left, Rect.top, Listbox1.Items[Index]);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
listbox1.Items.add('dfsf sdgfhjdslkfg sdkjf dslfkgh sdgj');
end;
end.