要在屏幕上按1:1的比例显示一张表格,客户要求所见即所得,在使用以下函数时得到的结果却与实际不符,
mmW := GetDeviceCaps(GetDC(0), HORZSIZE); //获得水平尺寸,单位mm
mmH := GetDeviceCaps(GetDC(0), VERTSIZE); //获得垂直尺寸,单位mm
显示器为22寸,分辨率1680*1050,测得的结果为320mm*240mm,在另一台同型号品牌的屏幕上又测的是其它结果,22寸显示器屏幕物理尺寸大约为480mm*300mm
请高手指点
mmW := GetDeviceCaps(GetDC(0), HORZSIZE); //获得水平尺寸,单位mm
mmH := GetDeviceCaps(GetDC(0), VERTSIZE); //获得垂直尺寸,单位mm
显示器为22寸,分辨率1680*1050,测得的结果为320mm*240mm,在另一台同型号品牌的屏幕上又测的是其它结果,22寸显示器屏幕物理尺寸大约为480mm*300mm
请高手指点
解决方案 »
- (急)如何控制在一个webbrowser打开新网页
- 开启新的程序后,如何关闭上一个程序窗口,我主要是想进行自动升级
- 自己定义的类使用时,也要调用create么?
- 关于QiuckRport的问题,高手救命啊,解决立即结帐
- 如何从其他程序(只能查询打印,无法导出数据)中取得数据?
- 请问: 有没有好用的做报表的利器?
- 请教:在QuickRep报表中的QRGroupFooter进行组内某字段求和统计
- 句柄是什么意思,谢谢,希望示例一下。马上给分。。。。。。。。。。。。。。。。
- 我公司QQ被封了,我不想用代理,那位程序员朋友使用MSN,与我建立联系!共同探讨问题,!!!!!!!!!!!MSN,MSN,MSN,MSN!!!!!
- 新手问题---怎么使edit为不可用态?
- 菜鸟求教大神帮忙啊!
- dbgrideh上如何显示提示信息
GetDeviceCaps reports info that the display driver provides. If the display driver declines to report any info, GetDeviceCaps calculates the info based on fixed calculations. If the display driver reports invalid info, GetDeviceCaps returns the invalid info. Also, if the display driver declines to report info, GetDeviceCaps might calculate incorrect info because it assumes either fixed DPI (96 DPI) or a fixed size (depending on the info that the display driver did and didn’t provide). Unfortunately, a display driver that is implemented to the Windows Display Driver Model (WDDM) (introduced in Windows Vista) causes GDI to not get the info, so GetDeviceCaps must always calculate the info.
其中 0x42-0x44 描述了显示设备的水平和垂直尺寸,单位mm。 0x42 水平尺寸低8位
0x43 垂直尺寸低8位
0x44 其中高4位是水平尺寸高8位,低4位为垂直尺寸高8位。
const ROOT_NODE = '\SYSTEM\CurrentControlSet\Enum\DISPLAY\';
{读取注册表显示设备EDID信息}
Reg.RootKey := HKEY_LOCAL_MACHINE;
Registry.OpenKeyReadOnly(ROOT_NODE);
{如果有多台显示器 \DISPLAY 至少包括2个以上子节点 其中第一个\Default_Monitor 可以忽略}
{读取VESA_MONITOR_ID列表}
Reg.GetKeyNames(MONITOR_IDS);
{每一个VMID下面还会有个PNP_ID节点}
Registry.OpenKeyReadOnly(MONITOR_IDS[i]);
{读取PNP_ID节点}
Reg.GetKeyNames(PNP_ID);
{到这可以读取显示器的EDID信息了}
Registry.OpenKeyReadOnly(PNP_ID[0] + '\Device Parameters');
{
Buf: array[0..$FF] of Byte;
HorW, VerH: WORD;
}
Reg.ReadBinaryData('EDID', Buf[0], sizeof(Buf));
HorW := ((Buf[$44] and $f0) shl 4) xor Buf[$42];
VerH := ((Buf[$44] and $0f) shl 8) xor Buf[$43];
您的程序中以下语句运行中出错
Reg.GetKeyNames(MONITOR_IDS);