我如何找到应用程序在C#中正在运行的屏幕 [英] How do I find what screen the application is running on in C#

查看:128
本文介绍了我如何找到应用程序在C#中正在运行的屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何确定我的应用程序在哪个屏幕上运行?

How do I determine what screen my application is running on?

推荐答案

这应该可以帮助您入门.在窗体上获取一个按钮和一个列表框,并将其放入Button_Click中:

This should get you started. Get a Button and a listbox on a Form and put this in the Button_Click:

listBox1.Items.Clear();
foreach (var screen in Screen.AllScreens)
{
    listBox1.Items.Add(screen);
}
listBox1.SelectedItem = Screen.FromControl(this);            

答案在最后一行,请记住,窗体也是控件.

The answer is in the last line, remember that a Form is a Control too.

这篇关于我如何找到应用程序在C#中正在运行的屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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