MeasureString() public method

This is the way to measure a string.
public MeasureString ( string aString ) : System.Drawing.Size
aString string
return System.Drawing.Size
Beispiel #1
0
 public TextRun(GDIFont aFont, int x, int y, int width, int height)
     :base("TextRun", x, y, width, height)
 {
     fIndexOfFirstCharacter = 0;
     fIndexOfNextCharacter = 0;
     fIndexOfLastCharacter = -1;
     fCharacters = new List<char>();
     fFont = aFont;
     fFontSize = fFont.MeasureString("W");
     Rectangle frame = Frame;
     frame.Height = fFontSize.Height;
     Frame = frame;
 }
        TextRun fCurrentTextRun;    // The TextRun object used to display the text
        #endregion

        #region Constructors
        public SingleLineTextEditor(string name, int x, int y, int width, int height)
            : base(name, x, y, width, height)
        {
            //Debug = true;
            SetEditMode(EditMode.Insert);

            fFont = new GDIFont("Courier", 24, Guid.NewGuid());
            fFontSize = fFont.MeasureString("W");

            fCaretStartPosition = new Point(4, 4);
            fCaretPosition = fCaretStartPosition;
            fCharacterPosition = 0;

            fCurrentTextRun = new TextRun(fFont, fCaretStartPosition.X, fCaretStartPosition.Y, fFontSize.Width, fFontSize.Height);
        }