using System; using System.Drawing; using System.Windows.Forms; class MyForm: Form { public MyForm() { Text = "Centered Form"; BackColor = SystemColors.Window; ForeColor = SystemColors.WindowText; ResizeRedraw = true; } protected override void OnPaint(PaintEventArgs pea) { Graphics grfx = pea.Graphics; string str = "MyString"; SizeF sizefText = grfx.MeasureString(str, Font); grfx.DrawString(str, Font, new SolidBrush(ForeColor), (ClientSize.Width - sizefText.Width) / 2, (ClientSize.Height - sizefText.Height) / 2); } }>Is there a way to know the the width and height of a string in pixels?