Convert Words DPI based Height and Width
OUTSIDE OF GFW:http://aritrasaha.wordpress.com/2009/04/20/convert-words-dpi-based-height-and-width/
The measurement system used by Office 2007 is slightly different from Windows forms – windows forms measurements are in pixels and Office measurements is in points. Hence, to convert from points to pixels, the following approach needs to be taken:-
- Calculate the dpi (dots per inch) from the graphics object of the windows form.
System.Drawing.Graphics g = myForm.CreateGraphics();
float dpi = g.DpiX;
This will return your systems dpi setting either normal 96 or large 120.
- A point is 1/72 of an inch so we divide the points by the dpi and multiple by 72 to get the pixels.
int WordWinWidth = (int)(this.Application.Width * dpi / 72);
int WordWinHeight = (int)(this.Application.Height * dpi / 72);