Get and Set Screen Resolution

后端 未结 6 1641
灰色年华
灰色年华 2020-11-27 18:07

How can I collect and change screen resolution using Visual C#?

6条回答
  •  孤城傲影
    2020-11-27 18:27

    This code will work perfectly in WPF. You can use it in either page load or in button click.

          string screenWidth =System.Windows.SystemParameters.PrimaryScreenWidth.ToString();
    
          string screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight.ToString();
    
          txtResolution.Text ="Resolution : "+screenWidth + " X " + screenHeight;
    

提交回复
热议问题