Autor Beitrag
Christoph Englmann
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 276



BeitragVerfasst: Fr 17.12.04 10:41 
Hallo,

hab ne listview und möchte für die spalte der ersten subitems nen anderen font verwenden...
Frage:
wie geht das?

habs auch schon auf nem dummen weg versucht aber indem ich direkt vor dem eintrag nen anderen font zuweise und danach wieder zurück... auch der funzt net:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
listview.items.add;
i := 1istview.items.count;
listview.items[i].caption := 'sadfsdf';

listview.font.name := 'Wingdins';
listview.items[i].subitems.add ('sdfsdf');
listview.font.name := 'MS Sans Serif';



danke
christoph
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Fr 17.12.04 10:59 
Hallo,

dazu musst Du das Ereignis OnCustomDrawSubItem bemühen.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
procedure TForm1.ListView1CustomDrawSubItem(
Sender TCustomListView; Item:TListItem; SubItem:Integer;
State:TCustomDrawState; var DefaultDraw:Boolean);
begin
  with Sender.Canvas do
  begin
    if (SubItem=1) then
    begin
      Font.Name:='Wingdings';
      Font.Size:=10;
      Font.Color:=clRed;
      Font.Style:=[fsBold];
    end
    else
    begin
      Font.Name:='MS Sans Serif';
      Font.Size:=8;
      Font.Color:=clBlack;
      Font.Style:=[];
    end;
  end; // with
end;

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
Christoph Englmann Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 276



BeitragVerfasst: Fr 17.12.04 11:38 
muchas gracias!!! das funzt