
11.07.2014, 12:08
|
Прохожий
|
|
Регистрация: 17.06.2014
Сообщения: 27
Версия Delphi: Delphi 7, XE6
Репутация: 10
|
|
Код:
procedure TMainApl.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var bmp:TBitmap;
begin
With (Control AS TlistBox) do begin
if odFocused in State then
if index mod 2 = 0 then
canvas.Brush.Color:=clRed
else
canvas.Brush.Color:=clYellow
else
canvas.Brush.Color:=color;
canvas.Font.Color:=canvas.Brush.Color xor RGB(255, 255, 255);
canvas.FillRect(rect);
bmp:=TBitmap.Create;
Imagelist1.GetBitmap(2, bmp);
Canvas.Draw(rect.Left, rect.Top - font.Size + (ItemHeight div 2),bmp);
Canvas.TextOut(rect.Left+bmp.Width+2, rect.Top - font.Size + (ItemHeight div 2),
Items.Strings[index]);
if odFocused in State then
DrawFocusRect(Canvas.Handle, Rect);
end;
end;
Теперь осталось последнее как нарисовать рамку
|