使用指定 StringFormat 对象的格式化属性,用指定的 Brush 和 Font 对象在指定的位置绘制指定的文本字符串。
public void DrawString(string, Font, Brush, PointF, StringFormat);
其中StringFormat类中有一个StringFormat.Alignment 属性可以获取或设置文本对齐方式的信息。
StringFormat.Alignment属性有三种对齐方式:Center,Far,Near。
设定一下,能不能达到你的目的?
public void DrawString(string, Font, Brush, PointF, StringFormat);
其中StringFormat类中有一个StringFormat.Alignment 属性可以获取或设置文本对齐方式的信息。
StringFormat.Alignment属性有三种对齐方式:Center,Far,Near。
设定一下,能不能达到你的目的?
解决方案 »
- 求一个 生成 SOAP 字符串的方法, 超级感谢..
- 怎样读取数据库里面字段的总和??帮顶一下!!
- C#access数据导出XML
- 逗号的unicode编码是什么?
- System Volume Information 是什么文件
- 托动图标,动态增加控件!
- 介绍点书看吧,公司要我们学C#
- 请问C#主要用在哪些方面?除了WEB方面,可以做应用软件或商业软件(指EXE格式的)吗?
- 急贴,大侠们帮忙!DropDownList在火狐可以获取选定值,在IE8不可以,为什么!!!!
- 谁有chartFxNet 和dundas控件的帮助文件及有关例子?
- [求助]如何用C#编写访问SQL的程序
- 如何不让Access数据库的大小爆炸增长?
StringFormat rightAligent=new StringFormat();//右对齐
rightAligent.Alignment=StringAlignment.Far;
g.DrawString(str,dataFont,dwBrush,x,y,rightAligent);
俺用GDI+画了个表格(实现了),现在想在一表格单元中drawstring,但如果一个sting太长它不会自动换行,会打印到边界去?如何实现它会自动换行?
strformat.Alignment=StringAlignment.Center;
strformat.LineAlignment=StringAlignment.Center;
to huan_jinwu(金屋藏娇,得抱源码归):
会自动换行,不过有限制,具体看矩形大小,最好宽一点。