用Canvas.Pen.TextOut方法输出的文字都是水平排列的,有没有方法输出非水平排列的文字?比如:斜的

解决方案 »

  1.   

    你想要的就是文字倾斜的效果吗??如果有的Label控件可以是倾斜的你要不要??
      

  2.   

    Delphi盒子上的例子:
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Label1: TLabel;
        procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
          Shift: TShiftState; X, Y: Integer);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    var
      LogFont : TLogFont;
      theFont : TFont;
    begin
      with Form1.Canvas do
      begin
        { 设置窗体画布的字体 }
        Font.Name := 'Arial';       { 字体 }
        Font.Size := 18;            { 字号 }
        Font.Color:= clBackground;  { 颜色 }
        { 创建新字体 }
        theFont := TFont.Create;
        theFont.Assign(Font);       { 新字体继承窗体画布字体的属性 }
        { 为新字体设置旋转属性 }
        GetObject(theFont.Handle, sizeof(LogFont), @LogFont);
        LogFont.lfEscapement:=450;{ 单位为(1/10)°}
        LogFont.lfOrientation:=450;
        theFont.Handle := CreateFontIndirect(LogFont);
        Font.Assign(theFont);
        theFont.Free ;
        { 使用新字体在鼠标按下的位置显示文字信息 }
        TextOut(X,Y, '倾斜字体' ) ;
      end;
    end;end.