How do I enable a second monitor in C#?

前端 未结 5 998
后悔当初
后悔当初 2020-11-30 01:39

Is it possible to enable a second monitor programatically and extend the Windows Desktop onto it in C#? It needs to do the equivalent of turning on the checkbox in the image

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-30 02:06

    I don't have the full answer here but I am almost sure that you will have to call out of .Net to do this. You will have to use Pinvoke to call an unmanaged dll. A great resource for this is pinvoke.net.

    I did a quick search and found http://www.pinvoke.net/default.aspx/user32/ChangeDisplaySettings.html which probably isn't exactly what you want but you will probably find it somewhere on pinvoke.net

提交回复
热议问题