Using the default 'MeasureString and 'DrawString: leading-space and trailing-space may be automatically added when the string is rendered:
"The MeasureString method is designed for use with individual strings and includes a small amount of extra space before and after the string to allow for overhanging glyphs. Also, the DrawString method adjusts glyph points to optimize display quality and might display a string narrower than reported by MeasureString." MSDN
Use one of the StringFormat optional arguments as shown in the code here to block that default behavior.
Font font = new System.Drawing.Font("Arial", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
private void panel1_Paint(object sender, PaintEventArgs e)
{
Graphics pe = e.Graphics;
float aa = pe.MeasureString("PROGRAMMING", font,0,StringFormat.GenericTypographic).Width + 40;
pe.DrawString("PROGRAMMING", font, Brushes.White, new PointF(40, 40), StringFormat.GenericTypographic);
pe.DrawLine(new Pen(Brushes.CadetBlue, 4), new PointF(40, 40), new PointF(aa, 40));
}