Delphi-PRAXiS

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 Flatterhaftes tStringGrid (https://www.delphipraxis.net/99227-flatterhaftes-tstringgrid.html)

grenzgaenger 8. Sep 2007 23:02


Flatterhaftes tStringGrid
 
Hallo Leuts,

hab mal wieder 'n problem mit 'n tStringGrid, aber erst mal der code für die onCellDraw Routine

Delphi-Quellcode:
begin
 with (sender as tStringGrid) do
 begin
  isSet := false; //Flag für Zeichenroutine
  if not (gdFixed in State) and (aRow > 0) and (aCol > 0) then
  begin
   if (aRow = 1) and (aCol = DayOf(dtpSelectDate.Date)) then //dtp = DateTimePicker
   begin
    canvas.Pen.Color := clRed;
    canvas.Pen.Width := 3;
    font.Color      := clRed;
    font.Style      := [fsBold];
    canvas.Rectangle(rect);
    DisplayText((sender as tStringGrid), (sender as tStringGrid).cells[acol, arow], taRightJustify);
    isSet := true;
   end;

   //hier soll noch mehr gezeichnet werden

   if not isSet then
   begin
    font.Color := clBlue;
    font.Style := [];
    brush.Color := clWindow;
    Canvas.FillRect(Rect);
    DisplayText((sender as tStringGrid), (sender as tStringGrid).cells[acol, arow], taRightJustify);  
   end;
  end;
 end;
end;
dabei kommt es zu zwei merkwürdigkeiten... :gruebel:

a) das ganze grid, flattert im program... keine ahnung warum, sieht jedenfalls recht unschön aus...
b) es wird die falsche zelle fett dargestellt (hier: aCol+1)

weiss jemand, wie man die beiden probleme beseitigen könnt?

Herzlichen Dank
gg

grenzgaenger 15. Sep 2007 13:51

Re: Flatterhaftes tStringGrid
 
hab die lösung gefunden... hier noch 'n link... Lösung aus DP


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:12 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