获得屏幕大小

mac2022-06-30  61

API:

要取得屏幕大小,可以用下面几个函数: int  cx   =   GetSystemMetricsSM_CXFULLSCREEN ); int  cy   =   GetSystemMetricsSM_CYFULLSCREEN ); 通过上边两个函数获取的是  显示屏幕的大小,但不包括任务栏等区域。   int  cx   =    GetSystemMetrics(    SM_CXSCREEN   );    int  cy   =    GetSystemMetrics(    SM_CYSCREEN   );   这两个函数获取的是真正屏幕的大小。MFC: HDC hDC =  :: GetDC( HWND( NULL));                //  得到屏幕DC   int x  =  :: GetDeviceCaps(hDC, HORZRES);        //  宽   int y  =  :: GetDeviceCaps(hDC, VERTRES);         //  高    :: ReleaseDC( HWND( NULL),hDC);                   //  释放DC

转载于:https://www.cnblogs.com/Dennis-mi/articles/3417464.html

最新回复(0)