标签:winform os io for ar cti sp on new
wpf
//获取文字长度
private double MeasureTextWidth(string text, double fontSize, string fontFamily)
{
FormattedText formattedText = new FormattedText(
text,
System.Globalization.CultureInfo.InvariantCulture,
FlowDirection.LeftToRight,
new Typeface(fontFamily.ToString()),
fontSize,
Brushes.Black
);
return formattedText.WidthIncludingTrailingWhitespace;
}
winform
System.Drawing.Size fontSize = System.Windows.Forms.TextRenderer.MeasureText(value, new System.Drawing.Font("Arial", (float)btnDisplay.FontSize));
标签:winform os io for ar cti sp on new
原文地址:http://www.cnblogs.com/metoer/p/3939774.html