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

Как изменить шрифт у нескольких записей в ListBox ?   Найти похожие ветки 

← →
Max Ivanych ©   (2004-10-28 14:10) [0]

Заранее спасибо за ответ!


← →
antonn ©   (2004-10-28 14:17) [1]

Использовать OnDrawItems. Смотри, где-то рядом было..


← →
ssk ©   (2004-10-28 14:43) [2]

Вот пример.

procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
 Rect: TRect; State: TOwnerDrawState);
var
 s: string;
begin
 with ListBox1 do
   begin
     s := Items[Index];
     Canvas.FillRect(Rect);
     case Index of
       0: begin
            Canvas.Font.Name := "Tahoma";
            Canvas.Font.Style := [fsBold];
          end;
       1: begin
            Canvas.Font.Name := "Tahoma";
            Canvas.Font.Style := [fsItalic];
          end;
     end;
     Canvas.TextOut(0, Rect.Top, s);
   end;
end;

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


← →
Max Ivanych ©   (2004-10-28 14:52) [3]

ssk ©
Спасибо!


← →
ssk ©   (2004-10-28 15:21) [4]

Вот пример.

procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
 Rect: TRect; State: TOwnerDrawState);
var
 s: string;
begin
 with ListBox1 do
   begin
     s := Items[Index];
     Canvas.FillRect(Rect);
     case Index of
       0: begin
            Canvas.Font.Name := "Tahoma";
            Canvas.Font.Style := [fsBold];
          end;
       1: begin
            Canvas.Font.Name := "Tahoma";
            Canvas.Font.Style := [fsItalic];
          end;
     end;
     Canvas.TextOut(0, Rect.Top, s);
   end;
end;

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



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

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



Память: 0.46 MB
Время: 0.022 c
1-1099401968
Жекасиымси
2004-11-02 16:26
2004.11.14
утилита FC


10-1056879071
iZEN
2003-08-01 22:31
2004.11.14
RMI в JBuilder


6-1093435835
Zyb
2004-08-25 16:10
2004.11.14
Вопрос тем, кто писал Proxy


4-1096918358
X-RayMan
2004-10-04 23:32
2004.11.14
Точность...


1-1099352808
Roma2004
2004-11-02 02:46
2004.11.14
Как поместить данные в DLL?




   Наверх