Einzelnen Beitrag anzeigen

Benutzerbild von sakura
sakura

Registriert seit: 10. Jun 2002
Ort: München
11.412 Beiträge
 
Delphi 11 Alexandria
 
#3
  Alt 20. Mai 2003, 15:20
Hier ein Anfang. Einfach mal testen.
Delphi-Quellcode:
var
  OldFontHandle: THandle;
  LogFont: TLogFont;
  FinalRect: TRect;
  Txt: String;
begin
  Txt := 'Sample';

  with PaintBox1 do
  begin
    SetGraphicsMode(Canvas.Handle, GM_ADVANCED);
    GetObject(Canvas.Font.Handle, SizeOf(LogFont), @LogFont);
    LogFont.lfEscapement := 1800;
    LogFont.lfOrientation := 0;
    LogFont.lfQuality := ANTIALIASED_QUALITY;
    OldFontHandle := Canvas.Font.Handle;
    Canvas.Font.Handle := CreateFontIndirect(LogFont);
    try
      FinalRect := Rect(50, 50, Width, Height);
      Windows.DrawText(Canvas.Handle, @Txt[1], Length(Txt), FinalRect,
          DT_EXTERNALLEADING + DT_NOPREFIX + DT_LEFT + DT_NOCLIP +
          DT_WORDBREAK);
    finally
      DeleteObject(Canvas.Font.Handle);
      Canvas.Font.Handle := OldFontHandle;
    end;
    SetTextCharacterExtra(Canvas.Handle, 0);
    SetGraphicsMode(Canvas.Handle, GM_COMPATIBLE);
  end;
end;
......
Daniel W.
Ich bin nicht zurück, ich tue nur so
  Mit Zitat antworten Zitat