how to change desktop screen resolution

蓝咒 提交于 2020-01-03 06:04:31

问题


I want to change screen resolution with c# code in desktop application.


回答1:


This is a similar question to "I want to change the clock" or "I want to change the user password" or "I want to change the Windows theme". An application program has no business making such system configuration changes, accordingly it isn't wrapped by the .NET framework.

You can do it, but it will require P/Invoke. Use ChangeDisplaySettingsEx(). Not exactly easy to use, nor very safe to use. Lots of LCD panels only look good in one particular resolution, the one that the user selected. Picking a resolution that the monitor cannot support produces a black screen and the three-finger salute. Smoke in the good old days.




回答2:


You can't do it by build in classes in C#/.net, but you can do it by win api, it is explained here. Then go to pinvoke.net or create your p/invoke methods manually.



来源:https://stackoverflow.com/questions/2371446/how-to-change-desktop-screen-resolution

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!