【发布时间】:2016-07-28 10:43:25
【问题描述】:
有代码:
using (Graphics g = Graphics.FromImage(pictureBox1.Image))
{
Font drawFont = new Font("Arial", 12);
Font drawFontBold = new Font("Arial", 12, FontStyle.Bold);
SolidBrush drawBrush = new SolidBrush(Color.Black);
g.DrawString("this is normal", drawFont, drawBrush, new RectangleF(350f, 250f, 647, 200));
g.DrawString(" and this is bold text", drawFontBold, drawBrush, new RectangleF(350f, 250f, 647, 200));
}
我需要得到
这是正常的这是粗体字
但我在第一个收到第二个文本的覆盖
【问题讨论】:
-
矩形指定位置。两个文本具有相同的坐标。
-
在第二个 DrawString 中更改 647 和 200 以正确调用 MeasureString 方法来连接它
标签: c#