C#中使用DrawString绘制文本时怎样使文本居中或右对齐 StringFormat.LineAlignment = StringAlignment.Center; 水平对齐 = 居中StringAlignment.Far; 对右 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 format.LineAlignment = StringAlignment.Center; // 更正: 垂直居中format.Alignment = StringAlignment.Center; // 水平居中RectangleF 排版框 = new Rectangle(Point.Zero, new Size(nWidth, nHeight));g.DrawString(_ShowName, stringFont, Brushes.Black, 排版框, format); 出现了一个错误提示:Point.Zero, ponit不包含zero的定义。 Point.Empty,或new Point(0,0) 除使用上述对齐方式外 g.DrawString(_ShowName, stringFont, new SolidBrush(Color.Black), new PointF(0, 0), format);红字部分要使用矩形,比如替换成new rectangle(0,0,背景图.width,背景图.height)这使得StringFormat限定在这个矩形内. C# WebServices返回自定义泛型--在线等待 C# udp文件传输问题? c# 调用 C DLL时,类参数对应C#什么类型?结构?【急】 c# 怎么调用excel组件在excel中画图 论坛代码重写中,初始化及部分页面以写完,大家给点意见!:) 求救,遇到“在此上下文中不允许使用名称 "**"。.....不允许使用列名。” 如何用vb.net 调用C#的dll 求教:从mp3文件中读取了若干字符,作为文件名,老是提示“路径中有非法字符” look at C# 提取特定字符串之后的字符串 急急急 Windows服务访问网络磁盘驱动的问题
format.LineAlignment = StringAlignment.Center; // 更正: 垂直居中
format.Alignment = StringAlignment.Center; // 水平居中RectangleF 排版框 = new Rectangle(Point.Zero, new Size(nWidth, nHeight));
g.DrawString(_ShowName, stringFont, Brushes.Black, 排版框, format);
或new Point(0,0)
g.DrawString(_ShowName, stringFont, new SolidBrush(Color.Black), new PointF(0, 0), format);
红字部分要使用矩形,比如替换成new rectangle(0,0,背景图.width,背景图.height)
这使得StringFormat限定在这个矩形内.