![]() |
Re: StringGrid Mehrzeilig
Ich hätte es so gelöst (im OnDrawCell des Grids) :
Delphi-Quellcode:
Nachtrag: Ich habe es noch ausgebessert, in der vorherigen Variante wurde immer die SL erzeugt... :oops:
Var
CrLfPos, PrevPos, i : Integer; SL : TStrings; Begin With Sender As TStringGrid Do Begin If aCol < FixedCols Then Exit; If aRow < FixedRows Then Exit; PrevPos := 1; CrLfPos := PosEx(#13#10, Cells[aCol, aRow], PrevPos); If CrLfPos > 0 Then Begin SL := TStringList.Create; Try // such Zeilenumbrüche While CrLfPos > 0 Do Begin // rein in die SL SL.Add(Copy(Cells[aCol, aRow], PrevPos, CrLfPos - PrevPos)); PrevPos := CrLfPos + 2; CrLfPos := PosEx(#13#10, Cells[aCol, aRow], PrevPos); End; If SL.Count > 0 Then // Canvas des Grids With Canvas Do Begin SL.Add(Copy(Cells[aCol, aRow], PrevPos, Length(Cells[aCol, aRow]))); FillRect(Rect); For i := 0 To pred(SL.Count) Do // Zeichne Text (-Font.Height +2 entspricht einer Zeilenhöhe) TextOut(Rect.Left + 2, Rect.Top + 2 + ((-Font.Height + 2) * i), Sl[i]); End; Finally FreeAndNil(SL); End; End; End; End; |
Re: StringGrid Mehrzeilig
sorry :oops:
hatte vergessen, das ich hier mit Editmask arbeite und im Ondrawcell die textformatierung eingestellt habe. :wall: raik |
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:21 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