怎样将文字旋转90度显示,就象开始菜单里的“WINDOWS....”一样?? 我在做一个输出显示的程序,要求是将文字旋转90度显示,和开始菜单里的“WINDOWN”一样的。如果是中文的话,我可以采用@System这样类似的字体,然后用分行控制,但是这种字体不支持英文字母,还请高手指点。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 输出字符串,如何旋转,如何使输出字符串背景透明(摘自Delphi超级猛料) procedure AngleTextOut(CV: TCanvas; const sText: String; x, y, angle:integer); varLogFont: TLogFont;SaveFont: TFont;beginSaveFont := TFont.Create;SaveFont.Assign(CV.Font);GetObject(SaveFont.Handle, sizeof(TLogFont), @LogFont);with LogFont dobeginlfEscapement := angle *10;lfPitchAndFamily := FIXED_PITCH or FF_DONTCARE;end; {with}CV.Font.Handle := CreateFontIndirect(LogFont);SetBkMode(CV.Handle, TRANSPARENT);CV.TextOut(x, y, sText);CV.Font.Assign(SaveFont);SaveFont.Free;end; *********************************procedure TForm1.Button1Click(Sender: TObject);varlf : TLogFont;tf : TFont;beginwith Form1.Canvas do beginFont.Name := 'Arial';Font.Size := 24;tf := TFont.Create;tf.Assign(Font);GetObject(tf.Handle, sizeof(lf), @lf);lf.lfEscapement := 450;lf.lfOrientation := 450;tf.Handle := CreateFontIndirect(lf);Font.Assign(tf);tf.Free;TextOut(20, Height div 2, 'Rotated Text!');end;end;==================================procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);varLogFont : TLogFont;newFont : TFont;beginwith Form1.Canvas dobeginFont.Name := '黑体'; // 字体Font.Size := 32; // 字号Font.Color:= $00ffcc; // 颜色// 创建新字体newFont := TFont.Create;newFont.Assign(Font); // 新字体继承窗体字体的属性// 为新字体设置旋转属性GetObject(newFont.Handle, sizeof(LogFont), @LogFont);LogFont.lfEscapement :=600; //角度*10LogFont.lfOrientation :=600; //应设为同样的值LogFont.lfWidth:=20; //每个字符的大小LogFont.lfHeight:=90;newFont.Handle := CreateFontIndirect(LogFont);Font.Assign(newFont);newFont.Free;// 在鼠标按下的位置显示文字TextOut(X, Y, '旋转文字Demo');end;end; 用TlogFontlfEscapement用于控制字体倾斜度 图像处理小白问一个问题,关于图片透明 怎么让鼠标放在图片上可以出现“小手”形状拖动图片,类似ACDSee 心情不好,放个消息!程序员们可以有意外之财阿! 我想学用delphi的opengl编程,有用delphi写的这方面的书吗? 高手请进!! 如何在程序里检测BUTTON单击了N次之后,就变成灰色不能再使用了,这个检测BUTTON单击的属性是什么啊. 是DELPHI的问题还是我的问题 active form为何不能显示? 高手请进,其实不难关于打印 答题吧验证码识别平台正确率可以达到多少? 如何在ComboBox中列出系统字体? delphi 经典图书吐血甩卖 全新
procedure AngleTextOut(CV: TCanvas; const sText: String; x, y, angle:integer);
varLogFont: TLogFont;SaveFont: TFont;beginSaveFont := TFont.Create;SaveFont.Assign(CV.Font);GetObject(SaveFont.Handle, sizeof(TLogFont), @LogFont);with LogFont dobeginlfEscapement := angle *10;lfPitchAndFamily := FIXED_PITCH or FF_DONTCARE;end; {with}CV.Font.Handle := CreateFontIndirect(LogFont);SetBkMode(CV.Handle, TRANSPARENT);CV.TextOut(x, y, sText);CV.Font.Assign(SaveFont);SaveFont.Free;end; *********************************procedure TForm1.Button1Click(Sender: TObject);varlf : TLogFont;tf : TFont;beginwith Form1.Canvas do beginFont.Name := 'Arial';Font.Size := 24;tf := TFont.Create;tf.Assign(Font);GetObject(tf.Handle, sizeof(lf), @lf);lf.lfEscapement := 450;lf.lfOrientation := 450;tf.Handle := CreateFontIndirect(lf);Font.Assign(tf);tf.Free;TextOut(20, Height div 2, 'Rotated Text!');end;end;==================================procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);varLogFont : TLogFont;newFont : TFont;beginwith Form1.Canvas dobeginFont.Name := '黑体'; // 字体Font.Size := 32; // 字号Font.Color:= $00ffcc; // 颜色// 创建新字体newFont := TFont.Create;newFont.Assign(Font); // 新字体继承窗体字体的属性// 为新字体设置旋转属性GetObject(newFont.Handle, sizeof(LogFont), @LogFont);LogFont.lfEscapement :=600; //角度*10LogFont.lfOrientation :=600; //应设为同样的值LogFont.lfWidth:=20; //每个字符的大小LogFont.lfHeight:=90;newFont.Handle := CreateFontIndirect(LogFont);Font.Assign(newFont);newFont.Free;// 在鼠标按下的位置显示文字TextOut(X, Y, '旋转文字Demo');end;end;
lfEscapement用于控制字体倾斜度