اینم برای Twip اما با #C
A twip is 1/1440 of an inch
private static void SetUpTwipsPerPixel(bool Force /* = false */)
{
if (!Support.m_IsTwipsPerPixelSetUp || Force)
{
Support.m_TwipsPerPixelX = 0;
Support.m_TwipsPerPixelY = 0;
try
{
IntPtr ptr1 =
NativeMethods.GetDC(NativeMethods.NullIntPtr);
if (!ptr1.Equals(NativeMethods.NullIntPtr))
{
Support.m_TwipsPerPixelX = 1440 / ((double)
NativeMethods.GetDeviceCaps(ptr1, 0x58));
Support.m_TwipsPerPixelY = 1440 / ((double)
NativeMethods.GetDeviceCaps(ptr1, 90));
NativeMethods.ReleaseDC(NativeMethods.NullIntPtr, ptr1);
}
}
catch (Exception exception1)
{
ProjectData.SetProjectError(exception1);
ProjectData.ClearProjectError();
}
Support.m_IsTwipsPerPixelSetUp = true;
if ((Support.m_TwipsPerPixelX == 0) ||
(Support.m_TwipsPerPixelY == 0))
{
Support.m_TwipsPerPixelX = 15;
Support.m_TwipsPerPixelY = 15;
VB6Errors.RaiseError(7,
Resources.GetResourceString("Misc_SetUpTwipsPerPix el"));
}
}
}