如何通过脚本更改监视器设置以进行复制和扩展 [英] How can I change monitor settings to duplicate and extend via script

查看:113
本文介绍了如何通过脚本更改监视器设置以进行复制和扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用一台笔记本电脑作为电视的第二台显示器时,我想制作一个小脚本,该脚本将触发从扩展到克隆的屏幕设置,当设置为克隆时,应将屏幕设置设置为扩展.我想用c#编写它,因为它是我的主要语言,并且我认为它可以解决我的问题.

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.

谢谢您的帮助:)

推荐答案

不是编程解决方案,但您应该查看 DisplayFusion .它提供快捷方式或热键来更改多台显示器的显示设置,还为您提供了使用多台显示器必不可少的其他功能.

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 也会执行此操作,但是更新的程度不高.我曾经使用UltraMon多年,但最近又切换到DisplayFusion.

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

这篇关于如何通过脚本更改监视器设置以进行复制和扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆