扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:陈立平 来源:yesky 2007年11月1日
关键字:
procedure TForm1.ListBox2DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); var AIcon, BIcon: TIcon; begin try file://从上述ImageList1中装入两个图标 AIcon := TIcon.Create; BIcon := TIcon.Create; file://装入图标到AIcon, BIcon ImageList1.GetIcon(0, AIcon); ImageList1.GetIcon(1, BIcon); file://填充绘图区 ListBox1.Canvas.FillRect(Rect); file://判断ListBox1中的当前重绘项是否被选中,根据状态装入不同的图标 if odSelected in State then ListBox1.Canvas.Draw(Rect.Left, Rect.Top, AIcon) else ListBox1.Canvas.Draw(Rect.Left, Rect.Top, BIcon); file://输出文字 ListBox1.Canvas.TextOut(Rect.Left + AIcon.Width div 2, Rect.Top + 2, ListBox1.Items[Index]); finally AIcon.Free; BIcon.Free; end; end; |
procedure TForm1.Button1Click(Sender: TObject); begin SendMessage(ListBox1.Handle, LB_SETHORIZONTALEXTENT, ListBox1.Width + 30, 0); end; |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者