![]() |
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. |
Re: Schrift Bold in bestimmten Zellen im Stringgrid? Geht da
das müsste im "onDrawCell" ereignis gehen
|
Re: Schrift Bold in bestimmten Zellen im Stringgrid? Geht da
siehe
![]()
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; |
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? |
Re: Schrift Bold in bestimmten Zellen im Stringgrid? Geht da
Delphi-Quellcode:
So besser :?:
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; |
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? |
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 20:47 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