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

TComboBox ItemIdex   Найти похожие ветки 

← →
Cat ©   (2005-06-09 15:56) [0]

Как в TComboBox ItemIdex сделать шрифт другого цвета у последних двух элементов ItemIdex.


← →
ssk ©   (2005-06-09 16:51) [1]

примерно так:


var
 Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
 Rect: TRect; State: TOwnerDrawState);
var
 s: string;
 k, k1: integer;
begin
 with ComboBox1 do
   begin
     s := Items[Index];
     Canvas.FillRect(Rect);
     case Index of
       3:
         begin
           Canvas.Font.Name := "Tahoma";
           Canvas.Font.Style := Canvas.Font.Style + [fsBold];
           Canvas.Font.Color := clBlue;
         end;
       4:
         begin
           Canvas.Font.Name := "Tahoma";
           Canvas.Font.Style := Canvas.Font.Style + [fsItalic, fsBold];
           Canvas.Font.Color := clRed;
         end;
     end;
     Canvas.TextOut(5, Rect.Top + 1, s);
   end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 ComboBox1.Style := csOwnerDrawFixed;
 ComboBox1.Clear;
 ComboBox1.Items.Add("Первая строка");
 ComboBox1.Items.Add("Вторая строка");
 ComboBox1.Items.Add("Третья строка");
 ComboBox1.Items.Add("Четвертая строка");
 ComboBox1.Items.Add("Пятая строка");
end;


← →
ssk ©   (2005-06-09 16:53) [2]

переменные k и k1 не нужны. забыл убрать.



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

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



Память: 0.45 MB
Время: 0.023 c
3-1116331690
Гость2
2005-05-17 16:08
2005.06.29
Вопрос по SQL-запросу


1-1118081025
redlord
2005-06-06 22:03
2005.06.29
регулярные выражения


1-1118127516
Andy BitOff
2005-06-07 10:58
2005.06.29
Ошибка: "Cannot open file ..."


14-1117816051
ArMellon
2005-06-03 20:27
2005.06.29
Лучшие песни Within temptation


1-1118049202
ORMADA
2005-06-06 13:13
2005.06.29
Поймать TImage под курсором




   Наверх