procedure
TForm1
.
ListBox1DrawItem(control: TWinControl;
index:
integer
;
rect: trect; state: DrawState);
var
bitmap : TBitmap;
offset :
integer
;
bmprect: TRect;
begin
with
(Control
as
TListBox).Canvas
do
begin
FillRect(rect);
bitmap := TBitmap
.
Create;
bitmap
.
LoadFromFile(ListBox1
.
Items[Index]);
offset :=
0
;
if
bitmap <>
nil
then
begin
bmprect := Bounds(rect
.
left +
2
, rect
.
top +
2
,
(rect
.
bottom - rect
.
top -
2
) *
2
, rect
.
bottom - rect
.
top -
2
);
BrushCopy(bmprect, bitmap, Bounds(
0
,
0
, bitmap
.
width, bitmap
.
height),
bitmap
.
Canvas
.
Pixels[
0
, bitmap
.
height -
1
]);
offset := (rect
.
bottom - rect
.
top +
1
) *
2
;
end
;
TextOut(rect
.
left + offset, rect
.
top, ListBox1
.
Items[index]);
bitmap
.
Free;
end
;
end
;
Комментарии