Delphi 图形处理 技巧
2006-05-16 08:57
411 查看
1。得到输出字符串在 屏幕上的象素数。
BOOL GetTextExtentPoint32( HDC hdc, // handle of device context LPCTSTR lpString, // address of text string int cbString, // number of characters in string LPSIZE lpSize // address of structure for string size );
利用该函数 我们可以得到 字符串在屏幕上的 象素数。
应用举例:使不同长度字符串 输出时 右 对齐。
var Str:String; sizeFont:Size; ndata:integer; begin str:='13456'; with Image1.Canvas do begin GetTextExtentPoint32(Image1.Canvas.Handle, PChar(str), Length(str), sizeFont); TextOut(100 - sizeFont.cx,10,str); str:='13456789'; GetTextExtentPoint32(Image1.Canvas.Handle, PChar(str), Length(str), sizeFont); TextOut(100 - sizeFont.cx,30,str); ndata:=-13456; str:=Inttostr(ndata); GetTextExtentPoint32(Image1.Canvas.Handle, PChar(str), Length(str), sizeFont); TextOut(100 - sizeFont.cx,60,str);
end;
相关文章推荐
- Delphi GDI+ 图形处理(2)
- 原创 ···DELPHI 图片图形图像处理 PS置换滤镜效果,亮度/对比度,纹理贴图效果
- Android绘图机制与处理技巧(三)——Android图像处理之图形特效处理
- delphi, Mapobjects(mo)开发一些技巧,图形对象类型转换
- Delphi中的图形显示技巧
- Delphi中的图形显示技巧
- word中visio图形的处理技巧
- 【WebFOCUS使用技巧】Unix环境下图形报表不能显示的处理
- 利用Delphi为Visual C++添加JPEG图形处理功能
- Delphi中的图形显示技巧
- Delphi中的图形显示技巧
- Delphi GDI+ 图形处理(3)
- Android绘图机制与处理技巧(四)Android图像处理之图形特效处理
- Delphi中的图形显示技巧
- DELPHI图形编辑技巧二则
- 利用Delphi为Visual C++添加JPEG图形处理功能
- Delphi GDI+ 图形处理(3)
- JDBC中日期/时间的处理技巧
- shell多参数处理技巧
- MFC 图形图像处理 -- 总结