Вниз
Скачать: 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.45 MB
Время: 0.007 c
2-1227115087
snake-as
2008-11-19 20:18
2008.12.28
Хранить TStrings в файле


15-1224695834
Добежал
2008-10-22 21:17
2008.12.28
Vista и CriticalSection


2-1227171059
Андрей Алекс.
2008-11-20 11:50
2008.12.28
Перенос данных из таблицы в таблицу


1-1205207136
Igor23
2008-03-11 06:45
2008.12.28
FireFox+TWebbrowser


11-1194856460
Soloton
2007-11-12 11:34
2008.12.28
KOL и XML




   Наверх