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 Schrift Bold in bestimmten Zellen im Stringgrid? Geht das? (https://www.delphipraxis.net/12001-schrift-bold-bestimmten-zellen-im-stringgrid-geht-das.html)

unitedlb 18. Nov 2003 16:39


Schrift Bold in bestimmten Zellen im Stringgrid? Geht das?
 
hallo!
ich würde gerne abhängig von dem inhalt einer zelle den enthalten text in bold anzeigen lassen.
geht das überhaupt?

vielen dank.

SirThornberry 18. Nov 2003 16:50

Re: Schrift Bold in bestimmten Zellen im Stringgrid? Geht da
 
das müsste im "onDrawCell" ereignis gehen

himitsu 18. Nov 2003 17:10

Re: Schrift Bold in bestimmten Zellen im Stringgrid? Geht da
 
siehe Einzelne Zellen im Grid markieren ??

Delphi-Quellcode:
Procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
  Begin
    If (ACol = 4) and (ARow = 2) Then Begin {Zelle auswählen}
      StringGrid1.Canvas.Brush.Color := StringGrid1.Color;
      StringGrid1.Canvas.FillRect(Rect);
      StringGrid1.Canvas.Font := StringGrid1.Font;
      StringGrid1.Canvas.Font.Style := [fsBold];
      StringGrid1.Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top + 2,
        StringGrid1.Cells[ACol, ARow]);
    End;
  End;

unitedlb 18. Nov 2003 17:11

Re: Schrift Bold in bestimmten Zellen im Stringgrid? Geht da
 
mit ondraw kann ich aber nur per canvas den textstyle bestimmen,
und dann auch nicht per cells[x,y] darauf zugreifen.

gibt es noch eine andere lösung?

himitsu 18. Nov 2003 18:12

Re: Schrift Bold in bestimmten Zellen im Stringgrid? Geht da
 
Delphi-Quellcode:
Procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
  Begin
    If StringGrid1.Cells[ACol, ARow] = '1' Then Begin {Zelleninhalt auf irrgend etwas prüfen...} 
      StringGrid1.Canvas.Brush.Color := StringGrid1.Color;
      StringGrid1.Canvas.FillRect(Rect);
      StringGrid1.Canvas.Font := StringGrid1.Font;
      StringGrid1.Canvas.Font.Style := [fsBold];
      StringGrid1.Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top + 2,
        StringGrid1.Cells[ACol, ARow]);
    End;
  End;
So besser :?:

unitedlb 18. Nov 2003 18:26

Re: Schrift Bold in bestimmten Zellen im Stringgrid? Geht da
 
ja super, danke!
wann wird drawcell ausgelöst? ich kann das selber ja nicht auslösen oder?

SirThornberry 18. Nov 2003 18:30

Re: Schrift Bold in bestimmten Zellen im Stringgrid? Geht da
 
da gibts bestimmt eine methode repaint oder so, damit kann man das auslösen, ansonsten halt immer wenn das stringrid gezeichnet werden muss


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