Delphi-PRAXiS
Seite 3 von 3     123   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi ListView Columns und OwnerDraw (https://www.delphipraxis.net/85218-listview-columns-und-ownerdraw.html)

Nils_13 10. Feb 2007 19:34

Re: ListView Columns und OwnerDraw
 
Ich habe PBExListview weiterentwickelt:
Delphi-Quellcode:
private
  FColumnBrushColor : TColor;
  [...]

protected
  procedure WMDrawItem(var Message : TWMDrawItem); message WM_DRAWITEM;
  [...]

published
  property ColumnBrushColor : TColor
      read FColumnBrushColor write FColumnBrushColor;
  [...]

[...]

procedure TColumnListView.WMDrawItem(var Message : TWMDrawItem);
var State    : TOwnerDrawState;
    SaveIndex : Integer;
begin
  with Message.DrawItemStruct^ do
  begin
    State := TOwnerDrawState(WordRec(LongRec(itemState).Lo));
    SaveIndex := SaveDC(hDC);
    FCanvas.Handle := hDC;
    FCanvas.Font  := Font;
    FCanvas.Brush.Color := FColumnBrushColor;
    if itemID = DWORD(-1) then FCanvas.FillRect(rcItem)
    else DrawItem(Items[itemID], rcItem, State);
    FCanvas.Handle := 0;
    RestoreDC(hDC, SaveIndex);
  end;
  Message.Result := 1;
end;
Setzt man allerdings die Komponente auf die Form, tut sich nichts. Warum ?


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:33 Uhr.
Seite 3 von 3     123   

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz