Autor Beitrag
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 20.12.05 21:03 
Ich hab versucht, in einer Listview die einzelnen Zeilen sowohl vom Text her, als auch vom Background je nach Inhalt hervorzuheben, was ansich auch ganz gut funktioniert, zumindest in der selbstprogrammierten TCustomListView (erster Source Schnipsel), im zweiten aber irgendwie nur in der ersten Spalte:

ausblenden OVCLDebugView.pas
1:
2:
3:
4:
5:
6:
procedure TOVCLDebugView.OmCDI(Sender: TCustomListView; Item: TListItem;
  State: TCustomDrawState; var DefaultDraw: Boolean);
begin
    Sender.Canvas.Brush.Color := GetItemColor(Item);
    Sender.Canvas.FillRect(Item.DisplayRect(drLabel));

end;


ausblenden volle Höhe VFSMain.pas
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:
32:
33:
34:
35:
36:
Procedure TVFSExplorer_Main.OmCDI(Sender: TCustomListView; Item: TListItem;
    State: TCustomDrawState; Var DefaultDraw: Boolean);
Var
    FO: TOVFSObject;
    BMSrc, BMDest: TBitmap;
Begin
    FO := TOVFSObject(Item.Data);

    If Not Assigned(FO) Then
        Exit;

    If FO.FileAttributes And VFS_ATTRIBUTE_IS_DIR <> 0 Then
        Item.ImageIndex := 0
    Else
        Item.ImageIndex := 1;

    If FO.FileAttributes And VFS_ATTRIBUTE_COMPRESSED <> 0 Then
        Sender.Canvas.Brush.Color := $FFEFEF
    Else
        Sender.Canvas.Brush.Color := clWhite;
    Sender.Canvas.FillRect(Item.DisplayRect(drLabel));


    If FO.FileAttributes And VFS_ATTRIBUTE_ENCRYPTED <> 0 Then
        Sender.Canvas.Font.Color := clGreen
    Else
        Sender.Canvas.Font.Color := clBlack;

    If FO.FileAttributes And VFS_ATTRIBUTE_HIDDEN <> 0 Then
    Begin
        If TListView(Sender).SmallImages.GetBitmap(Item.ImageIndex, BMSrc) Then
        Begin
          If MyAlphaBlend(BMSrc, BmDest, 50Then
              TListView(Sender).SmallImages.Insert(Item.ImageIndex, BMDest, nil);
        End;
    End;
End;


Ein CustomDrawSubItem Event wird in beiden Fällen NICHT genutzt.

Das komische an diesem Bug ist aber, dass er nur unter Win2K aufzutreten scheint. Delphi-Version ist bei mir und user profile iconmatze.de gleich (jeweils D7). Unterschied zwischen unseren beiden Systemen ist, dass ich Win2K nutze, matze WinXP. Die DebugListView funktioniert auf beiden Systemen fehlerfrei.

Wäre für Hinweise, woran das liegen könnte, sehr dankbar.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
BenBE Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 20.12.05 21:21 
k, das Problem hat sich erledigt ;-)

Ich hatte in meiner Version gegenüber Matze den Unterschied, dass bei mir aus unerfindlichen Gründen noch ein OnCustomDrawSubItem definiert war, was zu besagtem Fehler führte. Da diese lokale Source-Abweichung bei Matze nicht war, lief's bei ihm...

Merke: Bei Listviews, bei denen die gesamte Zeile einheitlich gefärbt sein soll, darf nur OnCustomDrawItem gesetzt werden.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.