Delphi利用Windows GDI实现文字倾斜
摘要

Delphi利用Windows GDI实现文字倾斜

procedure TForm1.FormPaint(Sender: TObject);
var
  FLogFont: tagLogFontW;
  hTempFont, hPrevFont: HFONT; //字体句柄
  hTempDC: HDC; //设备描述表或图形设备句柄
  TempString: string; //输出的文字
begin
  FLogFont.lfHeight := 10; //字高
  FLogFont.lfWidth := 10; //字宽
  FLogFont.lfWeight := 1;  //字体笔划粗细程度
  FLogFont.lfUnderline := 0; //没有下划线
  FLogFont.lfStrikeOut := 0; //没有删除线
  FLogFont.lfItalic := 0; //斜体效果否
  FLogFont.lfCharSet := GB2312_CHARSET; //字符集
  FLogfont.lfEscapement := 450; //倾斜度
  // FLogFont.lfOrientation := 450;  //方向与倾斜度取值同
  FLogFont.lfFaceName := '宋体';//字体名称
  //创建逻辑字体
  hTempFont := CreateFontIndirect(FLogFont);
  TempString := '测试';

hTempDC := GetDC(Handle); //取出窗口设备的当前字体,并替换为新字体
  hPrevFont := SelectObject(hTempDC, hTempFont);//设置设备窗口的文字色彩
  SetTextColor(hTempDc, clRed);
  TextOut(hTempDc, 200 , 200, PChar(TempString), Length(TempString));
  SelectObject(hTempDc, hPrevFont);
  DeleteObject(hTempFont);
  ReleaseDC(Handle, hTempDC);
end;

最新文章

  1. 【原创】android内存管理-内存泄漏原因
  2. 解决iPhone中overflow:scroll;滑动速度慢或者卡的问题
  3. MySQL性能优化的最佳20+条经验(转)
  4. Android开发之异步通信Handler机制
  5. 自定义手势_GestureOverlayVIew
  6. 16个最棒的jQuery视差滚动效果教程
  7. [转] Understanding Twitter Bootstrap 3
  8. Struts2命令空间小结
  9. JMeter性能测试,完整入门篇
  10. solr索引库的创建
  11. CDH5.16.1启动报错:Invalid value set for db.setupType, the valid values are EMBEDDED or EXTERNAL
  12. LeetCode - Subarray sum equals k
  13. 使用miniconda创建python虚拟环境
  14. 对象转Json时,Date类型格式化问题
  15. //{{AFX_MSG、//{{AFX_VIRTUAL、//{{AFX_MSG_MAP、//{{AFX_DATA_INIT
  16. HDOJ1008
  17. java判断字符串中是否含有中文
  18. vue向路由组件传递props
  19. Activity及Intent
  20. Unity3D研究院之DontDestroyOnLoad的坑

热门文章

  1. java oop第15章_Socket网络编程
  2. 软工-五月心得体会 PB16110698
  3. python 对象的删除
  4. Android SDK中无法安装HAXM installer
  5. 使用ribbon实现负载均衡
  6. 论文阅读笔记:《Interconnected Question Generation with Coreference Alignment and Conversion Flow Modeling》
  7. Foxmail公司邮箱配置
  8. 物理像素,逻辑像素,解决1px的问题
  9. CF755G PolandBall and Many Other Balls/soj 57送饮料
  10. EF批量添加