Autor Beitrag
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: So 13.02.05 19:51 
Nachdem ich den Code von wulfskin bekommen habe:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.Button1Click(Sender: TObject);  
var  
  ListItem: TListItem;  
begin  
  ListItem := ListView1.Items.Add;  
  ListItem.Caption := 'Rot';  
  ListItem.Data := Pointer(clRed);  
end;  

 
procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;  
  Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);  
begin  
  with Sender.Canvas.Font do begin  
    Style := [fsBold];  
    Color := TColor(Item.Data);  
  end;  
end;


würde es mich interessieren, ob jede Zeile ein eigenes Sytle bekommen kann.
Also, z.B. schreib ich fsBold in Item.Data, aber wie übergeb ich das jetzt an Style?

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: So 13.02.05 19:57 
Hallo nochmal,
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
type
  PMyFont = ^TMyFont.
  TMyFont = record
    Style: TFontStyles;
    Color: TColor;
  end;

procedure TForm1.Button1Click(Sender: TObject);  
var  
  ListItem: TListItem;
  MyFont: PMyFont;
begin  
  ListItem := ListView1.Items.Add;
  ListItem.Caption := 'Rot';
  New(MyFont);
  with MyFont^ do begin
    Style := [fsBold]; 
    Color := clGreen;
  end; 
  ListItem.Data := MyFont;
end;  

 
procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;  
  Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);  
begin  
  with Sender.Canvas.Font do begin  
    Style := PMyFont(Item.Data)^.Style;  
    Color := PMyFont(Item.Data)^.Color;
  end;  
end;
Ungetestet.

GRuß Hape!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Di 15.02.05 21:07 
Ja gut danke, aber ich mach das ganze jetzt mitm RichEdit. Soll ein Chatfenster werden. Dann hab ich aber wieder ein paar Fragen. Bitte mal im anderen Thread "Teil-Text-Formatierung und Zeilenumbruch" gucken.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)