【发布时间】:2020-04-03 01:56:49
【问题描述】:
Rectangle Location = new Rectangle(X , Y, W, H);
var TextFormat = new StringFormat() { Alignment = StringAlignment.Far };
string Text = "RRRR1234567890123456789012345678901234567890RRRR";
e.Cache.DrawString(Tekst,_Font,_Brush, Location, TextFormat);
嗨,
我正在使用此代码在矩形“位置”内右对齐字符串“文本”。如果宽度'W'大于字符串的宽度,它工作正常
iTextWidth = (int)(e.Graphics.MeasureString(Text, _Font).Width);
但如果宽度'W'小于iTextWidth,它仍然显示例如 RRRR1234567890123 代替 8901234567890RRRR
我做错了什么
【问题讨论】:
标签: c# alignment drawstring