Autor Beitrag
MrKnogge
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 76

Win XP, Win 7
Delphi 7 Prof, Delphi 2005 PE, C# (VS 2008)
BeitragVerfasst: So 23.05.04 09:42 
Hallo,

ich hab die Frage auch schon in der Delphi-Praxis gestellt, aber dort konnt mir leider keiner weiterhelfen.

Kann man die Farbe der Columns von einem TListView's ändern, wenn ja wie ?


gruss & thx

_________________
MfG MrKnogge
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 23.05.04 10:23 
Hallo

selber zeichnen. ich hab da mal was im delphi-pool-gefunden, sonnst gugg mal hier:
www.delphi-groups.de...readid=14481;start=0
solltest du anpassen können.
Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: So 23.05.04 12:10 
Hallo,

mann muss noch nicht mal wirklich selber Zeichnen, man kann auch "dezent" in den Zeichen vorgang eingreifen. Über die Ereignisse, OnAdvancedCustomDrawItem und OnAdvancedCurtomDrawSubItem kannst du so eingreifen. Der foldende Code Färbt die erste Spalte, sowie jede für die ncihts anderes angegeben ist Rot, die zweite Grün, die dritte Gelb und die vierte Schwarz.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.ListView1AdvancedCustomDrawItem(Sender: TCustomListView;
  Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage;
  var DefaultDraw: Boolean);
begin
  Sender.Canvas.Brush.Color := clRed; // Dies wirkt sich auf alle Spalten aus, wenn ncihts anderes angegeben ist.
end;

procedure TForm1.ListView1AdvancedCustomDrawSubItem(
  Sender: TCustomListView; Item: TListItem; SubItem: Integer;
  State: TCustomDrawState; Stage: TCustomDrawStage;
  var DefaultDraw: Boolean);
begin
  case SubItem of
    1 : Sender.Canvas.Brush.Color := clGreen;
    2 : Sender.Canvas.Brush.Color := clYellow;
    3 : Sender.Canvas.Brush.Color := clBlack;
  end;
end;



Gruß
Klabautermann
MrKnogge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 76

Win XP, Win 7
Delphi 7 Prof, Delphi 2005 PE, C# (VS 2008)
BeitragVerfasst: So 23.05.04 12:22 
Danke Klabautermann, aber ich glaub da hast du mich missverstanden, ich möchte nicht die einzelnen Felder sondern den Hintergrund der Überschrift (bei vsReport) ändern, ich werd mir den link von Keldorn mal ansehen.

_________________
MfG MrKnogge
MrKnogge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 76

Win XP, Win 7
Delphi 7 Prof, Delphi 2005 PE, C# (VS 2008)
BeitragVerfasst: So 23.05.04 20:27 
@Keldorn
bei dem von dir geposteten Code fehlt leider was, für:
ausblenden Delphi-Quelltext
1:
FHeader := ListView_GetHeader(ListView2.Handle);					

fehlt mir die function ListView_GetHeader, kannst du mir den posten ?

_________________
MfG MrKnogge
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 23.05.04 20:35 
ausblenden Delphi-Quelltext
1:
uses CommCtrl ...					


Mfg Frank

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

Win XP, Win 7
Delphi 7 Prof, Delphi 2005 PE, C# (VS 2008)
BeitragVerfasst: So 23.05.04 21:33 
Alles klar, danke.

_________________
MfG MrKnogge