我选择用不同的打印机测试?结果每次通过
int nWidth=pDC->GetDeviceCaps(HORZRES);
int nHeight=pDC->GetDeviceCaps(VERTRES);
得出的大小都不一样,同样是A4纸张打印,比如有的是w 6714,h 4702,而有的w 3969,h2892,还有其他的,所以我想问下是否有转换的模式?或者还是打印机默认的映射模式不一样?
int nWidth=pDC->GetDeviceCaps(HORZRES);
int nHeight=pDC->GetDeviceCaps(VERTRES);
得出的大小都不一样,同样是A4纸张打印,比如有的是w 6714,h 4702,而有的w 3969,h2892,还有其他的,所以我想问下是否有转换的模式?或者还是打印机默认的映射模式不一样?
int cxPagePixels = pDC->GetDeviceCaps(HORZRES);
int cyPagePixels = pDC->GetDeviceCaps(VERTRES); int cxPageMilliMeters = pDC->GetDeviceCaps(HORZSIZE);
int cyPageMilliMeters = pDC->GetDeviceCaps(VERTSIZE);
int cyPagePixels = pDC->GetDeviceCaps(VERTRES); int cxPageMilliMeters = pDC->GetDeviceCaps(HORZSIZE);
int cyPageMilliMeters = pDC->GetDeviceCaps(VERTSIZE);
测试过cxPagePixels 和cxPageMilliMeters结果是一样的?惨
int cyPagePixels = pDC->GetDeviceCaps(VERTRES); int cxPageMilliMeters = pDC->GetDeviceCaps(HORZSIZE);
int cyPageMilliMeters = pDC->GetDeviceCaps(VERTSIZE);
测试过在同一台打印机cxPagePixels 和cxPageMilliMeters结果是一样的?惨,
惠普和的 epson还是不一样!◎◎◎2
在使用上述的pDC时,是否已经做了pDC->SetMapMode。
大家设置映射模式后再试试看是否一样。
在使用上述的pDC时,是否已经做了pDC->SetMapMode。
大家设置映射模式后再试试看是否一样。
我的打印机为Epson stylus phtoo 870,经过测试证明与映射模式无关。但并不象你们得到的数值是一样的,如下(pDC已与打印机相关联):
int cxPagePixels = pDC->GetDeviceCaps(HORZRES); //结果为2892
int cyPagePixels = pDC->GetDeviceCaps(VERTRES); //结果为3969
int cxPageMilliMeters = pDC->GetDeviceCaps(HORZSIZE); //结果为204
int cyPageMilliMeters = pDC->GetDeviceCaps(VERTSIZE); //结果为280即使pDC不与打印机相关联而是用GetDC()得到,其结果也不相同
int cxPagePixels = pDC->GetDeviceCaps(HORZRES); //结果为1152
int cyPagePixels = pDC->GetDeviceCaps(VERTRES); //结果为864
int cxPageMilliMeters = pDC->GetDeviceCaps(HORZSIZE); //结果为320
int cyPageMilliMeters = pDC->GetDeviceCaps(VERTSIZE); //结果为240
并且与我的显示器分辩率和实际尺寸相符。因此,有必要查看一下pDC是怎么来的,是不是与相关的设备相关联。
int cyPagePixels = pDC->GetDeviceCaps(VERTRES);
int cxPageMilliMeters = pDC->GetDeviceCaps(HORZSIZE);
int cyPageMilliMeters = pDC->GetDeviceCaps(VERTSIZE); double rax = cxPagePixels/cxPageMilliMeters;以后输出的时候都乘以个rax就行了!不过是用TEXT的映射模式。