问题
I am having trouble finding a way to force any display resolution/timing I want in my C# program. I am running Windows 7 with a GeForce 210 graphics card. My current method to achieve these custom resolutions is to use the driver GUI to manually add the custom resolutions and then use Windows calls to change to those resolutions but I need a way to add new custom resolutions in real time. I have looked into the NVAPI but I was not able to find a way to do this. I also looked into the command line tool for the graphics driver but I was not able to get it to work. My last resort is to rewrite the values in registry but I would really like to avoid that. I am willing to use a different programming language or a third party tool as long as I can invoke it from the command line via my program. Can anyone point me in the right direction?
Thanks in advance.
Update (8/16/2011): I have been working on this problem with NVIDIA and they are providing me with an advanced NVAPI that will allow me to recreate the functionality of their driver. They also confirmed that the basic version of NVAPI that they provide will not do this.
回答1:
You could try using ChangeDisplaySettings
I'm not sure if it will have all the options provided by the nvidia panel, but certainly the basics like resolution, refresh rate, screen orientation, etc. I've used it myself in the past to dynamically change screen orientation (rotate to landscape/portrait) on a click of a button.
回答2:
I was able to solve this problem by using the NDA version of the NVAPI. It still was not trivial but all of the tools are there.
来源:https://stackoverflow.com/questions/6835076/how-can-i-force-any-display-resolution-timing-i-want