var formattedText = new FormattedText(
Txbox.Text,
CultureInfo.CurrentUICulture,
FlowDirection.LeftToRight,
new Typeface(Txbox.FontFamily, Txbox.FontStyle, Txbox.FontWeight, Txbox.FontStretch),
Txbox.FontSize,
Brushes.Black);
Size size = new Size(formattedText.Width, formattedText.Height);
WPF 获取文本像素长度
最新推荐文章于 2023-01-20 14:32:45 发布