0
使用MeasureString绘制字符串时,它使用一些填充在给定位置绘制给定文本。什么是在DrawString方法中添加默认的TextMargin大小
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Size size = Size.Ceiling(e.Graphics.MeasureString("like", this.Font));
Rectangle rect = new Rectangle(15, 15, size.Width, size.Height);
e.Graphics.FillRectangle(Brushes.Blue, rect);
e.Graphics.DrawString("like", this.Font, Brushes.Violet, rect);
}
我想知道,是什么加入到绘制measurestring给定点填充差异。
请任何人澄清这一点。
使用度量字符串绘制字符串?您正在测量还是绘制 – EpicKip
@EpicKip - 请参考示例代码 – Amal
'使用MeasureString绘制字符串<<不可能。但我认为填充ik 1/8em或某物 – EpicKip