2012-08-09 37 views

回答

2

你可以使用FormattedText測量:

FormattedText formattedText = new FormattedText(
    "AAAAAAAA", 
    CultureInfo.CurrentCulture, 
    FlowDirection.LeftToRight, 
    new Typeface("Arial"), 16, Brushes.Black 
); 
MessageBox.Show(formattedText.Width.ToString());