BuildingCoder.CmdNewTextNote.GetStringWidth C# (CSharp) Method

GetStringWidth() static private method

static private GetStringWidth ( string text, Font font ) : double
text string
font System.Drawing.Font
return double
        static double GetStringWidth( string text, Font font )
        {
            double textWidth = 0.0;

              using( Graphics g = Graphics.FromHwnd( IntPtr.Zero ) )
              {
            textWidth = g.MeasureString( text, font ).Width;
              }
              return textWidth;
        }