Einzelnen Beitrag anzeigen

API

Registriert seit: 18. Apr 2004
637 Beiträge
 
#2

Re: Pathname kürtzen ohne MinimizeName aus Unit FileCtrl

  Alt 9. Aug 2009, 16:44
Delphi-Quellcode:
function MinimizeName(const Filename: string; Canvas: TCanvas; MaxLen: Integer): string;
var
  b: array [0..MAX_PATH] of Char;
  R: TRect;
begin
  StrCopy(b, PChar(Filename));
  R := Rect(0, 0, MaxLen, Canvas.TextHeight('Wq'));
  if DrawText(Canvas.Handle, b, Length(Filename), R,
    DT_SINGLELINE or DT_MODIFYSTRING or DT_PATH_ELLIPSIS or DT_CALCRECT or DT_NOPREFIX) > 0 then
    Result := b
  else
    Result := Filename;
end;
  Mit Zitat antworten Zitat