![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Images в ComboBox [D7, XP]
Sergey2 © (2008-05-16 11:00:00)Подскажите как в комобобоксе в выпадающем списке можно отобразить картинки ?
Ega23 (2008-05-16 11:07:00) [1]
procedure TCustomKdrDBLookupCombo.cbDrawItem(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
bmp : TBitmap;
Offset : Integer;
begin
with Canvas do
begin
FillRect(Rect);
bmp := TLookupItem(Items.Objects[Index]).Bitmap;
if bmp<>nil then
begin
BrushCopy(Bounds(Rect.Left + 2, Rect.Top, bmp.Width, bmp.Height),
bmp, Bounds(0, 0, bmp.Width, bmp.Height), bmp.TransparentColor);
Offset := bmp.Width + 2;
end
else
Offset := 2;
TextOut(Rect.Left + Offset, Rect.Top, Items[Index]);
end; // width
end;
И всё это на OnDrawItem
Style := csOwnerDrawFixed;
DVM (2008-05-16 11:04:00) [2]Style = csOwnerDrawFixed или csOwnerDrawVariable
+
OnDrawItem + возможно еще OnMeasureItem