Цитата:
Сообщение от Phedor
С каких пор (с какой версии) у списка строк появился метод AddObject?
В ListBox-е такого нет.
|
Хм...интересно а что это тогда
Код:
listbox1.Items.AddObject(String;TObject)
?!?!
Помоему так нужно добавлять TBitmap и при событие procedure DrawItem рисовать возле каждой строки Битмап в уменьшенном виде.
Код примерно такой:
Код:
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
BMP : TBitmap;
Offset,
OffsetT,
RHeight,
THeight,
W, H : Integer;
DRect : TRect;
begin
with (Control as TListBox).Canvas do begin
DRect := Bounds(Rect.Left + 95, Rect.Top + 2,
(Rect.Right - (Rect.Left + 95)) - 2,
(Rect.Bottom - Rect.Top) - 4);
FillRect(DRect);
RHeight := Rect.Bottom - Rect.Top;
BMP := TBitmap((Control as TListBox).Items.Objects[Index]);
if BMP <> nil then begin
if (BMP.Width > 90) or (BMP.Height > 90) then begin
if BMP.Width >= BMP.Height then begin
W := 90;
H := Trunc(90 * (BMP.Height / BMP.Width));
end else begin
H := 90;
W := Trunc(90 * (BMP.Width / BMP.Height));
end;
Offset := (RHeight - H) div 2;
DRect := Bounds(Rect.Left + 2, Rect.Top + Offset, W, H);
StretchDraw(DRect, BMP);
end else begin
Offset := (RHeight - BMP.Height) div 2;
Draw(Rect.Left + 1, Rect.Top + Offset, BMP);
end;
Offset := 98;
end;
THeight := TextHeight((Control as TListBox).Items[Index]);
OffsetT := (RHeight - THeight) div 2 + 1;
TextOut(Rect.Left + Offset, Rect.Top + OffsetT, (Control as TListBox).Items[Index])
end;
end;
Только вот чёто не работает...