AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Probleme mit TextWidth im String Grid

Ein Thema von Andidreas · begonnen am 2. Sep 2013 · letzter Beitrag vom 3. Sep 2013
Antwort Antwort
Blup

Registriert seit: 7. Aug 2008
Ort: Brandenburg
1.435 Beiträge
 
Delphi 10.4 Sydney
 
#1

AW: Probleme mit TextWidth im String Grid

  Alt 3. Sep 2013, 08:52
Ich versteh was Ihr meint und ich mein ich hab das auch schon so umgesetzt... Korrigiert mich wenn ich falsch liege...
Offensichtlich eher nicht. Um deine Struktur beizubehalten:
Delphi-Quellcode:
procedure DoOnDrawCell(...);
begin
  SetzeFontEigenschaften(ACol, ARow);
  {Zeichnen...}
end;
  
procedure prTStringGridAutoFit(strgrid : TStringGrid);

var
iMaxTextLength : Integer;
iCol, iRow : Integer;

begin

  //=== Auto Fit Columns =======================================================
  For iCol := 0 to (strGrid.ColCount -1) Do
  Begin
    iMaxTextLength := 0;
    For iRow := 0 To (strGrid.RowCount - 1 ) Do
    Begin

      SetzeFontEigenschaften(iCol, iRow);

      If strGrid.Canvas.TextWidth(strGrid.Cells[iCol, iRow]) > iMaxTextLength Then
      Begin
        iMaxTextLength := strGrid.Canvas.TextWidth(strGrid.Cells[iCol, iRow]);
      End;
    End;
    strGrid.ColWidths[iCol] := iMaxTextLength + 25;
  End;
  //============================================================================

end;

Geändert von Blup ( 3. Sep 2013 um 08:54 Uhr)
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:31 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