VirtualStringTree DoBeforeCellPaint
Liste der Anhänge anzeigen (Anzahl: 1)
Hallo Zusammen,
Ich habe eine Klasse von TVirtualStringTree abgeleitet und möchte die Methode DoBeforeCellPaint überschreiben. Wenn ich die Property Self.Colors.FocusedSelectionColor in dem Event ändere werden die Repaint-Ereignisse des Formulars nicht erneuert Siehe Anhang Wenn ich das Formular verschiebe, wird das Formular aktualisiert sobald ich die FocusedSelectionColor nicht anfasse, funktioniert auch alles wie gewünscht auch funktioniert das Scrollen mit mittlerer Maustaste nicht wenn die Eigenschaft gesetzt wird Könnte das eventuell mit einem Update-State zu tun haben?
Code:
Wie folgt "aufgerufen"
procedure TVSTGrid.DoBeforeCellPaint(Canvas: TCanvas; Node: PVirtualNode;
Column: TColumnIndex; CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect); var Data: PTTreeData; begin Try //Fully Customizable If Assigned(OnBeforeCellPaint) then begin inherited; //Easy to handle Row-Color Modification end else if Assigned(FBeforeRowDraw) then begin //Data^.RowColor is already been loaded in AddFields Method Data := Self.GetNodeData(Node); Canvas.Brush.Color := Data^.RowColor; if Self.Selected[Node] then begin Canvas.Brush.Color := Canvas.Brush.Color - $222222; end; { //dosent work, as the rest of the Form will not be repainted!? if (Canvas.Brush.Color - $222222) > $0 then begin //darker Color for Highlighting Self.Colors.FocusedSelectionColor := Canvas.Brush.Color - $222222; end else begin Self.Colors.FocusedSelectionColor := clGradientActiveCaption; end; //} Canvas.FillRect(CellRect); end else begin Data := Self.GetNodeData(Node); IF Data^.Index mod 2 = 0 then begin Canvas.Brush.Color := FRowModColor; Canvas.FillRect(CellRect); end; Canvas.Font.Color := Self.FRowModFontColor; end; Except on e:Exception do begin showmessage('DoBeforeCellPaint' + e.message); end; End; end;
Code:
procedure TFMain.grid_AntragBeforeRowDraw(VstGrid: TVSTGrid;
DataSet: TDataSet; var TargetColor: TColor); var ColorStr: String; begin ColorStr := DataSet.FieldByName('farbe').AsString; if ColorStr <> '' then begin TargetColor := StringToColor(ColorStr); end else begin TargetColor := clWhite; end; end; |
AW: VirtualStringTree DoBeforeCellPaint
push
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:00 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz