Are pixels ever a square on a monitor?

I am working on making my DPI application sensitive using this MSDN guide , where the zoom technique uses the logical pixels X and Y from the device context.

int _dpiX = 96, _pdiY = 96;   
HDC hdc = GetDC(NULL);
if (hdc)
{
    _dpiX = GetDeviceCaps(hdc, LOGPIXELSX);
    _dpiY = GetDeviceCaps(hdc, LOGPIXELSY);
    ReleaseDC(NULL, hdc);
}

Then you can scale the X and Y coordinates using

int ScaleX(int x) { return MulDiv(x, _dpiX, 96); }
int ScaleY(int y) { return MulDiv(y, _dpiY, 96); }

Is there a situation where GetDeviceCaps(hdc, LOGPIXELSX)they GetDeviceCaps(hdc, LOGPIXELSY)will return different numbers for the monitor. The only device I'm really worried about is the monitor, so do I need to have separate functions ScaleX(int x)and ScaleY(int y)? Can I use only one function Scale(int px)? Will there be a flaw in this?

Thanks in advance for your help.

+5
source share
2 answers

, , . , , , .

, , , , , , (, ).

, . , . . , . - , .

+7

- . CRT, , , 320x200 320x400 4:3 ( ). - , - 5:4 .

+2

All Articles