How can I change monitor settings to duplicate and

2019-06-27 04:39发布

问题:

As I am using a laptop with a tv as its second monitor I want to make a little script which will trigger screen settings from extended to clone and when it is set to clone it should set the screen settings to extended. I want to make it in c# as it is my primary language and I think it could solve my problem.

So i have made a console application like this for now:

class Program
{
    static void Main(string[] args)
    {
        DisplayChanger.Start();
    }

    private static Process DisplayChanger = new Process
    {
        StartInfo =
        {
            CreateNoWindow = true,
            WindowStyle = ProcessWindowStyle.Hidden,
            FileName = "DisplaySwitch.exe",
            Arguments = "/extend"
        }
    };
}

It works fine creating a new process. But my question is, how can I check what status the "displays" have? I need that so i can run a test to see what process to start.

Thank you for your help :)

回答1:

Not a programming solution, but you should check out DisplayFusion. It provides either shortcuts or hotkeys to change display settings for multiple monitors plus gives you tons of other features essential for working with multiple monitors.

UltraMon does this too, but isn't updated nearly as much. I used to use UltraMon for years but more recently switched to DisplayFusion.