Вниз
Скачать: CL | DM;

Отрисовка ellipce в ListBox   Найти похожие ветки 

← →
Scot Storch   (2008-11-18 12:51) [0]

Необходимо для каждого item"a ListBox"а слева от текста нарисовать круг закрашеный определенным цветом.

Делаю так, но закрашивается вся область с текстом:


procedure Tform_Main.list_ResultDrawItem(ListBox: TCustomListBox_;
 Canvas: TCanvas; Index: Integer; var Rect: TRect; State: TOwnerDrawState;
 var Done: Boolean);
begin
 with Rect do
 begin
   Canvas.Brush.Color := TColor(ListBox.Items.Objects[Index]);
   Canvas.Ellipse(Left + 4, Top + 4, Left + 12, Bottom - 4);
   Inc(Left, 16);
 end;
end;

Помогите исправить


← →
MBo ©   (2008-11-18 13:06) [1]

после рисования эллипса Brush.style поставь bsClear


← →
{RASkov} ©   (2008-11-18 13:07) [2]

> [0] Scot Storch   (18.11.08 12:51)

procedure Tform_Main.list_ResultDrawItem(ListBox: TCustomListBox_;
Canvas: TCanvas; Index: Integer; var Rect: TRect; State: TOwnerDrawState;
var Done: Boolean);
begin
with (Control as TListBox).Canvas do
begin
  FillRect(Rect);
  TextOut(Rect.Left+16, Rect.Top, (Control as TListBox).Items[Index]);
  Brush.Color := TColor(ListBox1.Items.Objects[Index]);
  Ellipse(Rect.Left + 4, Rect.Top + 4, Rect.Left + 12, Rect.Bottom - 4);
  //Inc(Left, 16);
end;
end;


← →
Scot Storch   (2008-11-18 13:14) [3]

Всем спасибо



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.44 MB
Время: 0.009 c
8-1188571843
skvitek
2007-08-31 18:50
2008.12.28
чтение mp3 тегов


15-1225264023
depr
2008-10-29 10:07
2008.12.28
Извиняюсь. Еще вопросик, не успел.


2-1226994626
Костик
2008-11-18 10:50
2008.12.28
Создать файл


4-1202755664
Prosto Dimon
2008-02-11 21:47
2008.12.28
API internet explorer_server


2-1226768553
main
2008-11-15 20:02
2008.12.28
Быстрый Swap,




   Наверх