没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
翻译|其它|编辑:郝浩|2004-01-31 10:15:00.000|阅读 2757 次
概述:
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
procedure TForm1.ListBox2DrawItem(Control: TWinControl; Index:
Integer; Rect: TRect; State: TOwnerDrawState); var AIcon: TIcon; I, K : Integer; ARect, BRect: TRect; H : Integer; AStyle: TBrushStyle; begin try file://计算Item数量 I := ListBox2.Items.Count-1; AIcon := TIcon.Create; file://装入图标 ImageList1.GetIcon(0, AIcon); file://填充区域 ListBox2.Canvas.FillRect(Rect); file://计算Rect绘图区的高度 H := Rect.Bottom - Rect.Top; file://如果当前项是Item的最后一项,则在Canvas上没有Item的空白区绘制背景 if Index = I then begin K := 1; ARect := Rect; file://如果当前绘图项的底部小于ListBox2的Canvas的底部,有空白区域 While ARect.Bottom < ListBox2.Canvas.ClipRect.Bottom do begin file://一次计算下一个绘图区域 ARect.Top := Rect.Top + K * H; ARect.Bottom := ARect.Top + H; ListBox2.Canvas.stretchDraw(ARect, Image1.Picture.Bitmap); Inc(K); end; end; file://绘制当前项 ListBox2.Canvas.stretchDraw(Rect, Image1.Picture.Bitmap); file://绘制图标 ListBox2.Canvas.Draw(Rect.Left, Rect.Top, AIcon); ARect := Rect; ARect.Left := Rect.Left + AIcon.Width div 2; ARect.Top := ARect.top + 2; file://保存当前画笔的风格 AStyle := Listbox2.Canvas.Brush.Style; file://当前选中的Item要填充蓝色背景 if odSelected in State then begin ListBox2.Canvas.Brush.Style := bsSolid; Listbox2.Canvas.Brush.Color := clBlue; end else begin file://未选中项透明背景,前景色为黑色 ListBox2.Canvas.Brush.Style := bsClear; Listbox2.Font.Color := clBlack; end; file://输出文字 ListBox2.Canvas.TextOut(ARect.Left, ARect.top, ListBox2.Items[Index]); file://恢复当前画笔的风格 ListBox2.Canvas.Brush.Style := AStyle; finally AIcon.Free; end; end; |
ARect := Rect; ARect.Left := Rect.Left + AIcon.Width div 2; ARect.Top := ARect.top + 2; file://Windows Api函数调用 DrawText(ListBox3.Canvas.Handle, PChar(ListBox3.Items[Index]), Length(ListBox3.Items[Index]), ARect, 0); file://0-左对齐, 1---居中, 2--右对齐 |
procedure TForm1.ListBox4MeasureItem(Control: TWinControl; Index:
Integer; var Height: Integer); begin file://控制图片的高度 Height := 59; end; |
procedure TForm1.ListBox4DrawItem(Control: TWinControl; Index:
Integer; Rect: TRect; State: TOwnerDrawState); var ABmp: TBitmap; begin try ABmp := TBitmap.Create; ImageList2.GetBitmap(Index, ABmp); ListBox4.Canvas.FillRect(Rect); ListBox4.Canvas.Draw(Rect.Left, Rect.Top, ABmp); finally ABmp.Free; end; end; |
procedure TForm1.ListBox5MeasureItem(Control: TWinControl; Index:
Integer; var Height: Integer); begin file://控制图片的高度 Height := 59; end; |
procedure TForm1.ListBox5DrawItem(Control: TWinControl; Index:
Integer; Rect: TRect; State: TOwnerDrawState); var file://图片文件名 Fn: string; ABmp: TBitmap; begin try ABmp := TBitmap.Create; Fn := ListBox5.Items[Index]; ABmp.LoadFromFile(ListBox5.Items[Index]); Dec(Rect.Bottom); ListBox5.Canvas.FillRect(Rect); ListBox5.Canvas.StretchDraw(Rect, ABmp); finally ABmp.Free; end; end; |
var sr: TSearchRec; Dir: string; begin Dir := ''; file://选择目录对话框,需要在Uses中加入对FileCtrl单元的引用声明 if SelectDirectory('选择图片目录', '', Dir) then begin ListBox5.Items.Clear; file://搜索该目录下的所有bmp文件 if FindFirst(Dir + '\*.bmp', faReadOnly, sr) = 0 then begin ListBox5.Items.Add(Dir + '\' + Sr.Name); while FindNext(sr) = 0 do begin ListBox5.Items.Add(Dir + '\' + Sr.Name); end; FindClose(sr); end; end; end; |
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com
面对“数字中国”建设和中国制造2025战略实施的机遇期,中车信息公司紧跟时代的步伐,以“集约化、专业化、标准化、精益化、一体化、平台化”为工作目标,大力推进信息服务、工业软件等核心产品及业务的发展。在慧都3D解决方案的实施下,清软英泰建成了多模型来源的综合轻量化显示平台、实现文件不失真的百倍压缩比、针对模型中的大模型文件,在展示平台上进行流畅展示,提升工作效率,优化了使用体验。
本站的模型资源均免费下载,登录后即可下载。模型仅供学习交流,勿做商业用途。
本站的模型资源均免费下载,登录后即可下载。模型仅供学习交流,勿做商业用途。
本站的模型资源均免费下载,登录后即可下载。模型仅供学习交流,勿做商业用途。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@evget.com
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
慧都科技 版权所有 Copyright 2003-
2025 渝ICP备12000582号-13 渝公网安备
50010702500608号