![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Цветные Items в Combobox [D6, Win2k]
Jaxtor © (2004-12-03 11:56:00)Здравствуйте!
Не подскажите, через какой компонент лучше реализовать визуализацию определенного Item'а в ComboBox с данным цветом?
Jaxtor (2004-12-03 12:40:00) [1]>ssk © (03.12.04 12:20) [3]
Спасибо! Что-нибудь придумаю.
ssk (2004-12-03 12:20:00) [2]примерно так:
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
s: string;
begin
with ComboBox1 do
begin
s := Items[Index];
Canvas.FillRect(Rect);
Canvas.Font.Name := 'Tahoma';
case Index of
0: begin
Canvas.Brush.Color := clRed;
Canvas.Font.Style := Canvas.Font.Style + [fsBold];
end;
1: begin
Canvas.Brush.Color := clLime;
Canvas.Font.Style := Canvas.Font.Style + [fsItalic, fsBold];
end;
end;
Canvas.TextOut(Rect.Left+2 , Rect.Top+2, s);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ComboBox1.Style := csOwnerDrawVariable;
end;
нужное доработать самому
Jaxtor (2004-12-03 12:08:00) [3]>Reindeer Moss Eater © (03.12.04 12:02) [1]
Или самому написать такой компонент
Reindeer Moss Eater (2004-12-03 12:02:00) [4]Через компонент "руки и голова" и через событие OnDrawItem