![]() |
Gedrehter Text nicht sichtbar?
Hi *.* :hi:
Ich habe aus ![]() ![]() Daraus ergab sich folgender Code in meiner Paint-Routine:
Delphi-Quellcode:
Das funktioniert nur leider nicht.
procedure TASCustomVisuPanel.Paint;
const Alignments: array[TAlignment] of Longint = (DT_LEFT, DT_RIGHT, DT_CENTER); var Rect: TRect; FontHeight: Integer; Flags: Longint; LogFont: TLogFont; // drehbarer Text TempFont: TFont; begin Rect := GetClientRect; // Hintergrund zeichnen: if not Assigned(FBackgroundBitmap) and not ThemeServices.ThemesEnabled or not ParentBackground then begin Canvas.Brush.Color := Color; Canvas.FillRect(Rect); end; // Hintergrundbild einzeichnen: if Assigned(FBackgroundBitmap) then begin BitBlt(Canvas.Handle, Rect.Left, Rect.Top, Self.ClientWidth, Self.ClientHeight, FBackgroundBitmap.Canvas.Handle, 0, 0, SRCCOPY); end; // Rahmen zeichnen if BevelOuter <> bvNone then begin Frame3D(Canvas, Rect, FColorBorder, FColorBorder, BevelWidth); end; Frame3D(Canvas, Rect, Color, Color, BorderWidth); if BevelInner <> bvNone then begin Frame3D(Canvas, Rect, FColorBorder, FColorBorder, BevelWidth); end; Canvas.Brush.Style := bsClear; Canvas.Font := Self.Font; FontHeight := Canvas.TextHeight('W'); // Text ggf. drehen: if not (FTextAngle = 0) then begin TempFont := TFont.Create; try TempFont.Assign(Canvas.Font); GetObject(TempFont.Handle, SizeOf(LogFont), @LogFont); LogFont.lfEscapement := 10 * FTextAngle; LogFont.lfOrientation := 10 * FTextAngle; TempFont.Handle := CreateFontIndirect(LogFont); Canvas.Font.Assign(TempFont); finally FreeAndNil(TempFont); end; end; with Rect do begin Top := ((Bottom + Top) - FontHeight) div 2; Bottom := Top + FontHeight; end; Flags := DT_EXPANDTABS or DT_VCENTER or Alignments[FAlignment]; Flags := DrawTextBiDiModeFlags(Flags); DrawText(Canvas.Handle, PChar(Caption), -1, Rect, Flags); end; Nehme ich als Font z.B. Courier - also einen Font der nicht TrueType ist, wird dieser ganz normal horizontal gezeichnet. - Schliesslich soll das ja auch ![]() Benutze ich nun aber einen TrueType-Font, so sehe ich gar keinen Text. Was geht da schief? |
Re: Gedrehter Text nicht sichtbar?
Probiere statt DrawText mal TextOut - ich habe irgendetwas im Kopf, dass DrawText nicht mit gedrehtem Text umgehen kann...
|
Re: Gedrehter Text nicht sichtbar?
Zitat:
|
Re: Gedrehter Text nicht sichtbar?
Hrm. Also wenn ich DT_NOCLIP angebe zeichnet DrawText richtig.
Aber die Position stimmt nicht mehr so ganz, weil er bei der Berücksichtigung der Breite und der Höhe wohl die Rotation nicht berücksichtigt. Das tut TextOut allerdings auch nicht. Hilft mir also genau überhaupt nicht weiter. Das heisst letzlich, dass ich die Startposition des Textes in jedem Fall selber berechnen muss. Gibts da schon Formeln für? Ich Geometrie bin ich ne absolute Niete :pale: |
Re: Gedrehter Text nicht sichtbar?
Hi,
schau dir doch mal das an: ![]() Habe ich selber schon einmal verwendet und es hat hervorragend funktioniert :) |
Re: Gedrehter Text nicht sichtbar?
:wall:
Les mal meine letzte Anmerkung: Wie berechnest Du die korrekte Position von x und y? |
Re: Gedrehter Text nicht sichtbar?
Sinus/Cosinus zusammen mit dem Winkel?
|
Re: Gedrehter Text nicht sichtbar?
Zitat:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:47 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz