private void SetupDeviceRatio(int hDC, ESRI.ArcGIS.Display.IDisplay display)
{
if (display.DisplayTransformation != null)
{
if (display.DisplayTransformation.Resolution != 0)
{
m_dDeviceRatio = display.DisplayTransformation.Resolution / 72;
// Check the ReferenceScale of the display transformation. If not zero, we need to
// adjust the Size, XOffset and YOffset of the Symbol we hold internally before drawing.
if (display.DisplayTransformation.ReferenceScale != 0)
m_dDeviceRatio = m_dDeviceRatio * display.DisplayTransformation.ReferenceScale / display.DisplayTransformation.ScaleRatio;
}
}
else
{
// If we don't have a display transformation, calculate the resolution
// from the actual device.
if (display.hDC != 0)
{
// Get the resolution from the device context hDC.
m_dDeviceRatio = System.Convert.ToDouble(GetDeviceCaps(hDC, LOGPIXELSX)) / 72;
}
else
{
// If invalid hDC assume we're drawing to the screen.
m_dDeviceRatio = 1 / (TwipsPerPixelX() / 20); // 1 Point = 20 Twips.
}
}
}