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 ?