В аське аналог/потомок RichEdita.
Вот как можно в начало каждого итема запихнуть картинку в ЛистБоксе
| Код | procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); var Bitmap: TBitmap; Offset: Integer; BMPRect: TRect; begin with (Control as TListBox).Canvas do begin FillRect(Rect); Bitmap := TBitmap.Create; ImageList1.GetBitmap(1, Bitmap); //тут лежит битмап Offset := 0; if Bitmap <> nil then begin BMPRect := Bounds(Rect.Left+2, Rect.Top+2, (Rect.Bottom-Rect.Top-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)+3; end; TextOut(Rect.Left+Offset, Rect.Top, ListBox1.Items[index]); Bitmap.Free; end; end;
|
|