zoukankan      html  css  js  c++  java
  • 设置屏幕分辨率


    /*设置屏幕分辨率  width,Height,Color->SetPixelAndColor(1024,768,32)*/
    bool SetPixelAndColor(HDC  hdc,unsigned int Width,unsigned int Height,int BitsPerPixel)
    {
          DEVMODE   CurMode;
          int   result=1;
          for(int i=0;result;i++)
                result   =  EnumDisplaySettings(NULL,i,&CurMode);
          CurMode.dmPelsWidth          =   Screen-> Width;
          CurMode.dmPelsHeight         =   Screen-> Height;

          if(CurMode.dmPelsWidth!=Width ||CurMode.dmPelsHeight!=Height)
          {
                CurMode.dmPelsWidth    =   Width;
                CurMode.dmPelsHeight   =   Height;
                CurMode.dmBitsPerPel   =   BitsPerPixel;
                CurMode.dmFields   =   DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
                result   =   ChangeDisplaySettings(&CurMode, CDS_UPDATEREGISTRY);
                return   (result==DISP_CHANGE_SUCCESSFUL);
          }
          else
                return   false;
    }


    SetPixelAndColor(1024,768,32);


        /*首先得到窗体的默认分辨率,在程序关闭的时候恢复默认分辨率*/
        int sx=Screen->Width;
        int sy=Screen->Height;
        SetPixelAndColor(NULL,sx,sy,32);




  • 相关阅读:
    事物的五种配置方式(转载)
    Spring入门
    leetcode刷题3
    LeetCode刷题2
    LeetCode刷题1
    bootstraptable使用总结之前端样式设计
    初识Handsontable
    Java之file类
    OpenCV学习系列教程第五篇:测试和提高代码的效率
    OpenCV学习系列教程第四篇:图像的算术操作
  • 原文地址:https://www.cnblogs.com/xe2011/p/e4cc1d783edafad7a05ef0c5222c447a.html
Copyright © 2011-2022 走看看