C#高级GUI构想? [英] C# Advanced GUI Ideas?

查看:93
本文介绍了C#高级GUI构想?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,

我正在一个项目中,我只需要在数据显示(另一个屏幕)上显示我的GUI中的某个区域.我想拥有某种观众无法看到的背景控制室,我想通过只显示GUI中的某些部分并将其余部分留给我来做到这一点.我不知道如何开始思考.

Dears,

I am working on a project where I need to display only a certain area from my GUI on a datashow (another screen). I want to have some sort of background control room that is not visiable to the spectators, and I want to do it by just showing certain portion from the GUI and keeping the rest just to me. I have no idea about how to start thinking. Is there a way to create video driver that would send the needed portion to the other display?

推荐答案

为什么要用两个监视器进入这种棘手的游戏? (请查看我的问题,并告诉我们是否正确理解您的信息;这是关于两个不同的显示器的.)您将受到电缆长度的限制,而且还存在将UI的秘密"部分暴露给使用过的用户的风险.另一个监视器太高,原则上总是可以使用键盘显示它.

为什么不找一个明显的选择呢?通过网络连接两台不同的计算机.在两台不同的计算机上运行两个不同的进程,一个在后台控制室中,一个在第二个室中.从使用套接字编程(最好使用System.Net.Sockets.TcpListener/System.Net.Sockets.TcpClient),经典远程处理或WCF中进行选择(我建议通过在后台控制室主机中运行的某些进程(可能与后台控制室部分相同的进程)进行自托管WCF.另外,您可以有一个服务器应用程序(开发Windows Service)和两个运行客户端部分的不同进程,一个用于外部用户,一个用于后台控制室.服务本身可以在这两台计算机中的任何一台或在第三台计算机上运行;这并不是很重要,但可能取决于所需的功能.

而且不要以为使用额外的计算机会太昂贵.使用网络方法,您可以在开发上节省大量时间和投资,因此可以证明再使用一台计算机是合理的.

—SA
Why going into such tricky game with two monitors? (Please see my question and tell us if I understood you correctly; is it about two different monitors.) You would be limited by the length of a cable, also, the risk of exposing a "secret" part of UI to the used of another monitor is too high, as in principle it always possible to show it using keyboard.

Why not coming to an obvious alternative? Have two different computers connected by a network. Run two different processes on two separate computers, one in a background control room, one in a second room. Choose from using socket programming (better using System.Net.Sockets.TcpListener/System.Net.Sockets.TcpClient), classical remoting or WCF (I would suggest self-hosting WCF by some process running in the background control room host, maybe the same process as the background control room part). Alternatively, you can have one server application (develop Windows Service) and two different processes running client part, one for the outside user, one for background control room. The Service itself can run on any of these two computers or on third one; this is not really important but might depend on required functionality.

And don''t think that using an extra computer is too expensive. With network approach, you can save a lot of time and investment on just the development, so it can justify the use of a one more computer.

—SA


您好,

假设您仅使用一台具有多个屏幕的计算机,并且想在第二个屏幕上显示表单.

对于WPF应用程序:
Hello,

Assuming you use only one computer that has several screens and you want to show your form on the second screen.

For WPF applications:
int screnToUse = 1;
Screen[] screens = Screen.AllScreens;
var formToShowToSpectators = new FormToShowToSpectators();
formToShowToSpectators.BorderThickness = new Thickness(0);
formToShowToSpectators.WindowStyle = WindowStyle.None;
formToShowToSpectators.Left = screens[screnToUse].Bounds.Left;
formToShowToSpectators.Top = screens[screnToUse].Bounds.Top;
formToShowToSpectators.Show();



对于winform应用程序:



For a winform Application:

int screnToUse = 1;
Screen[] screens = Screen.AllScreens;
var formToShowToSpectators = new FormToShowToSpectators();
formToShowToSpectators.FormBorderStyle = FormBorderStyle.None;
formToShowToSpectators.Left = screens[screnToUse].Bounds.Left;
formToShowToSpectators.Top = screens[screnToUse].Bounds.Top;
formToShowToSpectators.StartPosition = FormStartPosition.Manual;
formToShowToSpectators.Show();



然后,由于无法在加载窗口之前最大化窗口,因此请更改WPF表单的Loaded Event中的状态:



Then because you can''t maximise a window before it is loaded change it''s state in the Loaded Event of your form for WPF:

private void Window_Loaded(object sender, RoutedEventArgs e)
{
    WindowState = System.Windows.WindowState.Maximized;
}



或在WinForm的Load Event处理程序中:



Or in the Load Event handler for WinForm:

private void FormToShowToSpectators_Load(object sender, EventArgs e)
{
    WindowState = FormWindowState.Maximized;
}



您将需要在WPF应用程序中添加对System.Windows.Form和System.Drawing的引用.
瓦莱里(Valery)



You will need to add references to System.Windows.Form and System.Drawing to a WPF application

Valery


这篇关于C#高级GUI构想?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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