Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.06.29;
Скачать: 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 вся ветка

Текущий архив: 2005.06.29;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.026 c
1-1118171137
Vulko
2005-06-07 23:05
2005.06.29
Проблема кодировки при idHTTP.Get


14-1117458253
evvcom
2005-05-30 17:04
2005.06.29
Весёлое сообщение об ошибке


3-1116234329
Maverick
2005-05-16 13:05
2005.06.29
Передача параметра в ADOStoredProc


8-1109794554
starlit
2005-03-02 23:15
2005.06.29
как поменять изображение у BitBtn? взять его из ImageList ?


14-1117958876
Piter
2005-06-05 12:07
2005.06.29
Что с интернетом?