GDI+ 绘制多行文本
2011-07-30 01:21
239 查看
绘制多行文本,如图:
View Code //private void Form1_Paint(object sender, PaintEventArgs e)
//{
// Graphics g = e.Graphics;
// FontFamily ff = new FontFamily(GenericFontFamilies.Serif);
// Font f = new Font(ff, 12, FontStyle.Italic|FontStyle.Bold|FontStyle.Strikeout|FontStyle.Underline) ;
// string str = "Heightfjdfjdkkkkkkhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhkkkkkkkkkkkkkkkkkkkkkkkkkfjdkkkkkkkkkkkkkkkkjf" + f.Height;
// //不添加而外的高度
// SizeF sf = g.MeasureString(str, f, int.MaxValue, StringFormat.GenericTypographic);
// Rectangle r = new Rectangle(0, 0, 200, f.Height * 6);
// g.DrawRectangle(Pens.Red,r);
// g.DrawString(str, f, Brushes.Blue, r, StringFormat.GenericTypographic);
//}
View Code //private void Form1_Paint(object sender, PaintEventArgs e)
//{
// Graphics g = e.Graphics;
// FontFamily ff = new FontFamily(GenericFontFamilies.Serif);
// Font f = new Font(ff, 12, FontStyle.Italic|FontStyle.Bold|FontStyle.Strikeout|FontStyle.Underline) ;
// string str = "Heightfjdfjdkkkkkkhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhkkkkkkkkkkkkkkkkkkkkkkkkkfjdkkkkkkkkkkkkkkkkjf" + f.Height;
// //不添加而外的高度
// SizeF sf = g.MeasureString(str, f, int.MaxValue, StringFormat.GenericTypographic);
// Rectangle r = new Rectangle(0, 0, 200, f.Height * 6);
// g.DrawRectangle(Pens.Red,r);
// g.DrawString(str, f, Brushes.Blue, r, StringFormat.GenericTypographic);
//}
相关文章推荐
- GDI+ 绘制多行文本,自动换行。
- C#--GDI+绘制多行文本和格式化文本
- C#--GDI+绘制多行文本和格式化文本
- GDI+中的文本绘制技术
- GDI+ 绘制自定义制表位位数的文本。
- GDI+在固定位置(固定点)的地方绘制文本
- C#利用GDI+绘制旋转文字,矩形内可以根据布局方式排列文本
- GDI+绘制自定义行距的文本的三种方法。
- 多行文本绘制
- 多行文本绘制
- 7.利用GDI+绘制文本
- GDI+绘制自定义行距的文本(续)
- C#中使用GDI+绘制形状时自动缩放文本
- 使用DrawTextEx绘制多行文本
- GDI+绘制竖向文本
- GDI+绘制文本
- win32下绘制多行文本
- 使用 GDI+ 绘制有间距的文本
- div css 多行文本 最后一行自动显示省略号
- Android UI 之居中绘制文本内容的正确方法——实现自定义一个TextView