2,497
社区成员
发帖
与我相关
我的任务
分享
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
begin
(Control as TListBox).Canvas.FillRect(Rect);
(Control as TListBox).Canvas.TextOut(Rect.Left, Rect.Top, (Control as TListBox).Items[Index]);
Edit1.Text := ListBox1.Items[Index];
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
self.ListBox1.Style := lbOwnerDrawFixed;
end;