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 tStringGrid mit eigener Zeichenroutine --> Selektionsproblem (https://www.delphipraxis.net/98679-tstringgrid-mit-eigener-zeichenroutine-selektionsproblem.html)

grenzgaenger 30. Aug 2007 20:43


tStringGrid mit eigener Zeichenroutine --> Selektionsprob
 
Liste der Anhänge anzeigen (Anzahl: 2)
Hallo Zusammen,

ich hab 'n Stringgrid, bei dem ich die Zeichenroutine überschrieben hab. Funktioniert auch blendend.

Delphi-Quellcode:
procedure tMyStringGrid.DrawCell(ACol, ARow: Integer; ARect: TRect;
  AState: TGridDrawState);
begin
 inherited;
 if not Odd(ARow) and not (gdFixed in aState) then
 begin
  Canvas.Brush.Color := clWebMintcream;
  Canvas.FillRect(aRect);
  Canvas.TextOut(aRect.Left+2, aRect.Top+2, Cells[ACol, ARow]);
 end;
end;
Nur wenn ich da die Zeile im Grid selektiere, blendet er mir meinen Text aus ...

gibt es hier einen Trick, dass man nach der Selektion einer Zeile (row) auch noch den geschriebenen Text entziffern kann?

Dank und Gruss
gg

PS: options.rowselect = true;

grenzgaenger 30. Aug 2007 23:14

Re: tStringGrid mit eigener Zeichenroutine --> Selektions
 
Hallo Kollegen,

jetzt hab ich die Lösung gefunden...

Delphi-Quellcode:
procedure tSEStringGrid.DrawCell(ACol, ARow: Integer; ARect: TRect;
  AState: TGridDrawState);
begin
 inherited;
 if not Odd(ARow) and not ((gdFixed in aState) or (gdSelected in aState)) then
 begin
  Canvas.Brush.Color := clWebMintcream;
  Canvas.FillRect(aRect);
  Canvas.TextOut(aRect.Left+2, aRect.Top+2, Cells[ACol, ARow]);
 end;
end;
die Selektion musste noch ausgeschlossen werden.

Grüsse und noch einen schönen Abend
gg

Real_Thunder 8. Nov 2007 22:38

Re: tStringGrid mit eigener Zeichenroutine --> Selektions
 
Öhmm....
Ich weiß nun nicht ob ich da flasch liege....
aber der text wird nicht ausgeblendet...
Das Probloem ist das an Weissen text nicht auf weisem Hintergrund Sieht...
bzw mit dem Cream Text:
ich habe es so gemacht:
Delphi-Quellcode:
  if aRow > 0  then begin
    c.Font.Color:=ClBlack;
    if (aRow mod 2) = 0 then begin
      c.Brush.Color := $00E6E7E8;
      c.FillRect(Rect);
    end else begin
      c.Brush.Color := ClWhite;
      c.FillRect(Rect);
    end;
    if arow = TStringgrid(sender).Row then begin
      c.Font.Color:=ClYellow;
      c.Brush.Color := ClBlue;
      c.FillRect(Rect);
    end;

    s := TStringGrid(sender).Cells[ACol, ARow];
    c.FillRect(Rect);
    rect.Left:=rect.Left+5;
    rect.Top:=rect.Top+2;
    DrawText(c.Handle, PChar(s), Length(s), Rect, DT_SINGLELINE or DT_LEFT);
  end;
MfG Real Thunder

habe bei mir allerdings ein rowselect drin.....
ansonsten einfach die makierte zelle abfangen... und dass sollte es denn sein


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