![]() |
Ausrichtung eines Textes in einer StringGrid Zelle
Moin
ich hoffe es kann mir einer helfen. Irgendwie finde nichts zum Ausrichten einer Zelle in SringGrid. Ich möchte gerne das die Texteinträge zentriert sind. Danke im Vorfeld. |
Re: Ausrichtung eines Textes in einer StringGrid Zelle
Da wirst du wohl kaum um das OnDrawCell Ereignis herum kommen.
Hier mal nen Beispiel auf die Schnelle:
Delphi-Quellcode:
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState); var s: string; begin s := StringGrid1.Cells[ACol, ARow]; StringGrid1.Canvas.FillRect(Rect); DrawText(StringGrid1.Canvas.Handle, PChar(s), Length(s), Rect, DT_Center); end; |
Re: Ausrichtung eines Textes in einer StringGrid Zelle
danke für die schnelle Antwort.
|
Re: Ausrichtung eines Textes in einer StringGrid Zelle
Ersetze das obige DrawText mal durch das hier:
Delphi-Quellcode:
DrawText(StringGrid1.Canvas.Handle, PChar(s), Length(s), Rect, DT_SINGLELINE or DT_CENTER or DT_VCENTER);
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:10 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