Autor Beitrag
mimi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: So 11.07.04 12:27 
Hallo,
ich habe zwei subitems und die möchte ich in unterschiedlichen farben anzeigen
wie geht das ???

_________________
MFG
Michael Springwald, "kann kein englisch...."
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: So 11.07.04 14:37 
wie immer: selber zeichnen: das listview hat diverse ondraw*** / onadvanceddraw*** ereignisse.

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: So 11.07.04 16:58 
ja das habe ich gemacht, aber leider färbt er die ganze zeile ein:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure TForm4.ListView1CustomDrawSubItem(Sender: TCustomListView;
  Item: TListItem; SubItem: Integer; State: TCustomDrawState;
  var DefaultDraw: Boolean);
begin
  if (Item=nil) then Exit;
  with Sender.Canvas do begin
    if StringToColor(ListView1.Items[item.Index].SubItems.Strings[0]) <> clNone then

      Font.Color:=StringToColor(ListView1.Items[item.Index].SubItems.Strings[0]);
    if StringToColor(ListView1.Items[item.Index].SubItems.Strings[1]) <> clNone then
      Font.color:=StringToColor(ListView1.Items[item.Index].SubItems.Strings[1]);
  end; 
end;

_________________
MFG
Michael Springwald, "kann kein englisch...."
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: So 11.07.04 19:17 
überleg mal genau, was du gemacht hast ...
egal welches subitem gezeichnet wird, beide Bedingungen treffen immer zu, und damit wird mit der letzten Farbwahl gezeichnet. Du mußt das übergebene Subitem auswerten:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
  if (Item=nil) then Exit;
  with Sender.Canvas do begin
    case subitem of
      1:Font.Color:=rgb(255,0,0);
      2:Font.color:=rgb(0,255,0);
    else end;
  end;


Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Mo 19.07.04 16:52 
vielen dank für deine hilfe, es hat funktioniert *G*

_________________
MFG
Michael Springwald, "kann kein englisch...."