private Size MeasureString()
{
var formattedText = new FormattedText(
this.myabc.Text,
CultureInfo.CurrentCulture,
FlowDirection.LeftToRight,
new Typeface(this.myabc.FontFamily, this.myabc.FontStyle, this.myabc.FontWeight, this.myabc.FontStretch),
this.myabc.FontSize,
Brushes.Black,
new NumberSubstitution(),
TextFormattingMode.Ideal);
formattedText.TextAlignment = TextAlignment.Right;
return new Size(formattedText.Width, formattedText.Height);
}
WPF 测量字符串显示大小
猜你喜欢
转载自blog.csdn.net/xionglifei2014/article/details/125428424
今日推荐
周排行