Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Label and DT_END_ELLIPSIS (https://www.delphipraxis.net/150881-label-dt_end_ellipsis.html)

sdean 29. Apr 2010 13:09


Label and DT_END_ELLIPSIS
 
Hi i use the following code to show the '...' or ellipsis when the label's caption doesn't fil its width :

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
S,M: string;
  R: TRect;
begin
  M:='or adjust label width';
  S := 'this is way too long to fit into a label - trim it down';
  UniqueString(S);
  R := label1.Canvas.ClipRect;
  label1.Canvas.Font := label1.Font;
  DrawText(label1.Canvas.Handle, PChar(S), Length(S), R,
    DT_END_ELLIPSIS or DT_MODIFYSTRING or DT_NOPREFIX);
  label1.Caption := S;
 end;
Label's width :201
Label's autosize : false .

the result will be : this is way too long to fit into a label - trim ...

But what i want is to add the M value 'or adjust label width ' after the ellipsis so the result will be :
this is way too long to fit into a label - trim ...or adjust label width

please how could i do this last one .


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