listbox1MeasureItem是定制Item的高度~~
ListBox1DrawItem()是自己画Item~~
ListBox1DrawItem()是自己画Item~~
解决方案 »
- fastreport 主从表。从表的数据全显示出来了
- 关于DLL中封装Frame,在frame中有pagecontrol控件切换不翻页求助和No parent
- 请问DELPHI的字符串结束符是什么?
- ToolBar如何在程序运行的时候自动能使用呢,现在都是灰色的哦……
- 再有一个小问题:怎么得到Windows系统启动位置?
- 插件是怎么作出来的?
- 几次提问都无人回答,这次是否有回复呢?
- 关于Delphi中ListView的一个问题
- 这个问题可能有些难度!敬请关注
- 我的query缓存更新有问题!updatesql
- 1请问listboxdrawItem()函数里的一句with listbox1.canvas do是什么意思啊?30分
- 300分紧急求救!(我用DELPHI生成的ACTIVEX DLL,注册成功之后,却无法使用?)
Bitmap: TBitmap;
begin
with Control as TListBox do
begin
Bitmap := TBitmap(Items.Objects[Index]);
if Bitmap <> nil then
if Bitmap.Height > Height then Height := Bitmap.Height;
end;
end;
var
Bitmap: TBitmap; { temporary variable for the item抯 bitmap }
Offset: Integer; { text offset width }
begin
with (Control as TListBox).Canvas do { draw on control canvas, not on the form }
begin
FillRect(Rect); { clear the rectangle }
Offset := 2; { provide default offset }
Bitmap := TBitmap((Control as TListBox).Items.Objects[Index]); { get the bitmap }if Bitmap <> nil then
begin
BrushCopy(Bounds(Rect.Left + 2, Rect.Top, Bitmap.Width, Bitmap.Height),
Bitmap, Bounds(0, 0, Bitmap.Width, Bitmap.Height), clRed); {render bitmap}
Offset := Bitmap.width + 6; { add four pixels between bitmap and text}
end;
TextOut(Rect.Left + Offset, Rect.Top, (Control as TListBox).Items[Index]) { display the text }
end;
end;