Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Fehler in DrawText ? (https://www.delphipraxis.net/38539-fehler-drawtext.html)

Gruber_Hans_12345 20. Jan 2005 16:18


Fehler in DrawText ?
 
Wenn ich die breite eines Textes ermittle, bekomme ich bei wenn ich die Schriftart "MS Sans Serif" in BOLD einstelle falsche Ergebnisse.
Andere Schriftarten in Bold oder "MS Sans Serif" ohne Bold funktionieren.

Hat jemand eine Ahnung warum und wie ich den DrawText dazu bringe, das der funktioniert ?

DrawText gibt bei "MS Sans Serif" in Bold immer einen 1 Pixel breiteren Wert zurück

Delphi-Quellcode:
    S1      := 'Test';

    Canvas.Font.Style  := [fsBold];
//    Canvas.Font.Style  := [];
    Canvas.Font.Name   := 'Ms Sans Serif';
//    Canvas.Font.Name   := 'Arial';
    Canvas.Font.Size   := 11;
    Memo1.Lines.Add('TW : '+IntToStr(Canvas.TextWidth(S1)));

    DrawText(Canvas.Handle, PChar(S1), Length(S1), R, DT_LEFT or DT_SINGLELINE or DT_TOP or DT_CALCRECT);
    Memo1.Lines.Add('TW : '+IntToStr(R.Right - R.Left));


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