![]() |
DBGrid -> Selektierte Zeile Fett
Hallo zusammen,
wenn ich in dem Ereignis DrawColumnCell folgendes einbaue:
Delphi-Quellcode:
dann macht er zwar die selektierte Zeile FETT, aber man sieht dahinter auch noch den Text in NICHT FETT. if (gdSelected in State) then begin DBGrid.Canvas.Font.Style := DBG_WorkFlow_GruppenBau.Canvas.Font.Style + [fsBold]; DBGrid.Canvas.Font.Color := clBlack; DBGrid.DefaultDrawColumnCell(Rect, DataCol, Column, State); end else begin DBGrid.Canvas.Font.Style := DBG_WorkFlow_GruppenBau.Canvas.Font.Style - [fsBold]; DBGrid.DefaultDrawColumnCell(Rect, DataCol, Column, State); end; Was muss ich tuen ? Gruss Holger |
AW: DBGrid -> Selektierte Zeile Fett
Dein Rect enthält noch "alten" Inhalt, mach erst mal sauber. Z.B:
Delphi-Quellcode:
DBGrid.Canvas.FillRect(Rect).
|
AW: DBGrid -> Selektierte Zeile Fett
Hallo,
habe es erweitert:
Delphi-Quellcode:
.. aber es ändert sich nichts ...
if (gdSelected in State) then
begin DBG_WorkFlow_GruppenBau.Canvas.FillRect(Rect); DBG_WorkFlow_GruppenBau.Canvas.Font.Style := DBG_WorkFlow_GruppenBau.Canvas.Font.Style + [fsBold]; DBG_WorkFlow_GruppenBau.Canvas.Font.Color := clBlack; DBG_WorkFlow_GruppenBau.DefaultDrawColumnCell(Rect, DataCol, Column, State); end else begin DBG_WorkFlow_GruppenBau.Canvas.Font.Style := DBG_WorkFlow_GruppenBau.Canvas.Font.Style - [fsBold]; DBG_WorkFlow_GruppenBau.DefaultDrawColumnCell(Rect, DataCol, Column, State); end; Der DrawingStyle des DBGrids ist auch gdsGradient. Liegt es eventuell daran ? |
AW: DBGrid -> Selektierte Zeile Fett
Hier mal ein Auszug aus meinem Fundus, der wie gewünscht funktioniert:
Delphi-Quellcode:
(Die fd....As... sind persitente Datenbankfelder.)
procedure TForm1.dbgDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin // Zeile mit dem aktiven Datensatz. if (fdID.AsInteger = dbg.Tag) then begin dbg.Canvas.Font.Style := [fsBold]; dbg.Canvas.Brush.Color := clLime; dbg.Canvas.Font.Color := clBlack; if Copy(fdIP.AsString,1,3) = 'DNS' then begin if (State = [gdSelected]) or (State = [gdSelected..gdFocused]) then begin dbg.Canvas.Brush.Color := clNavy; dbg.Canvas.Font.Color := clRed; end else begin dbg.Canvas.Brush.Color := clWhite; dbg.Canvas.Font.Color := clNavy; end; end; end else begin dbg.Canvas.Font.Style := []; end; // Sonderbehandlung für den Sendernamen if Column.FieldName = 'Sendername' then begin if Column.Field.Text = csSenderOhneName then begin if (State=[gdSelected]) or (State=[gdSelected..gdFocused]) then begin dbg.Canvas.Brush.Color := clRed; dbg.Canvas.Font.Color := clWhite; end else begin dbg.Canvas.Font.Color := clRed; end; end else if fdSenderName.AsString <> fdSenderTitel.AsString then begin if (State=[gdSelected]) or (State=[gdSelected..gdFocused]) then begin dbg.Canvas.Brush.Color := clPurple; dbg.Canvas.Font.Color := clWhite; end else begin dbg.Canvas.Brush.Color := clPurple; dbg.Canvas.Font.Color := clYellow; end; end; end else // und noch weitere IF-Elsen if ... end; dbg.DefaultDrawColumnCell(Rect, DataCol, Column, State); end; |
AW: DBGrid -> Selektierte Zeile Fett
DefaultDrawing steht vermutlich noch auch true.
Zitat:
|
AW: DBGrid -> Selektierte Zeile Fett
Hallo zusammen,
das war es DefaultDrawing muss auf FALSE Danke Gruss Holger |
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:41 Uhr. |
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