Einzelnen Beitrag anzeigen

sdean

Registriert seit: 5. Dez 2009
64 Beiträge
 
#1

Label and DT_END_ELLIPSIS

  Alt 29. Apr 2010, 13:09
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 .
  Mit Zitat antworten Zitat