AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi text gedreht (mit outline möglich ?)
Thema durchsuchen
Ansicht
Themen-Optionen

text gedreht (mit outline möglich ?)

Ein Thema von myicq · begonnen am 3. Okt 2016
Antwort Antwort
myicq

Registriert seit: 5. Jan 2016
70 Beiträge
 
Delphi 6 Professional
 
#1

text gedreht (mit outline möglich ?)

  Alt 3. Okt 2016, 14:04
Hallo alle,

ich mache erste Schritte in Grafik und Textdarstellung.

übung 1: Text gedreht. Ich habe folgendes bei einer andere Seite gefunden: [https://www.delphi-treff.de/tipps-tr...ext-ausgeben/]

Es geht, aber.. kann ich das auch mit Outline machen ? Oder soll ich hier eher in Richtung GDI+ schauen ? Wenn GDI+, wie würde mein Code aussehen.


Danke!

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    PaintBox1: TPaintBox;
    btn1: TButton;
    procedure btn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    procedure TextOutAngle(const Canvas: TCanvas; X, Y: Integer; const AText: string; AAngle: Integer);
    procedure ClearPaintBox(Sender:TObject);
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
{$R *.dfm}
procedure Tform1.TextOutAngle(const Canvas: TCanvas; X, Y: Integer; const AText: string; AAngle: Integer);
var
  hCurFont: HFONT;
  LogFont: TLogFont;
begin
  with Canvas do
  begin
    hCurFont := Font.Handle;
    try
      GetObject(Font.Handle, SizeOf(LogFont), @LogFont);
      LogFont.lfEscapement := AAngle;
      LogFont.lfOrientation := AAngle;

      Font.Handle:= CreateFontIndirect(LogFont);
      try
        TextOut(X, Y, AText);
      finally
        DeleteObject(Font.Handle);
      end;
    finally
      Font.Handle := hCurFont;
    end;
  end;
end;

procedure TForm1.ClearPaintBox(Sender:TObject);
var
  t:TRect;
begin

  with PaintBox1.Canvas do begin
      Brush.Color:=Form1.Color;
      FillRect(ClientRect);
  end;
end;


procedure TForm1.btn1Click(Sender: TObject);
var
  i: Integer;

begin
  i:=100;
  while i < 900 do
  begin
    Paintbox1.Canvas.Font.Name:='Arial';
    Paintbox1.Canvas.Font.Size:=48;
    paintbox1.Canvas.Brush.Style:=bsClear;
    PaintBox1.Canvas.pen.Width:=3;
    TextOutAngle(Paintbox1.Canvas, 290, 190, 'Textdrehung', i);
    Sleep(100);
    inc(i, 10);
    ClearPaintBox(nil);
  end;

end;


end.
  Mit Zitat antworten Zitat
Antwort Antwort

 

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:49 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