如何在特定的监视器打开一个特定的地方WPF应用程序 [英] How to open a WPF Application in a specific Place on a Specific Monitor

查看:117
本文介绍了如何在特定的监视器打开一个特定的地方WPF应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个应用程序,共同通信,更具体的我有app1.exe和app2.exe这2个应用程序是在同一台PC里面有一台显示器和一台电视机我怎么能打开app1.exe在电视上和其他的我的显示器。其实我使用被命名为实际多台监视器第三方工具来做到这一点。我的目标是因为我使用这个只为函数打开我的应用程序在合适的地方来删除此工具。这将是巨大的,如果有可能做到这一点使用code。我在使用WPF 的Visual Studio 2010

I have two application which communicates together, to be more specific I have app1.exe and app2.exe this 2 apps are in the same PC which has one monitor and one TV how can I open app1.exe on TV and the other on my Monitor. Actually to do this I'm using a third party tool which is named Actual Multiple Monitors. my goal is to remove this tool because I'm using this only for the function to open my applications in the right place. it would be great if there is a possibility to do this using code. I'm using WPF in Visual Studio 2010?

推荐答案

以下假设你有源头code到应用程序:

The following assumes that you have the source code to your applications:

您需要做两件事情:

首先使用System.Windows.Forms.Screen()来枚举你的屏幕。

Firstly use System.Windows.Forms.Screen() to enumerate your screens.

画面[] allScreens = Screen.AllScreens;

Screen[] allScreens = Screen.AllScreens;

然后你可以使用Screen.Bounds属性来确定,以显示你的主窗口。

Then you can you use the Screen.Bounds property to determine where to display your main window.

我不知道你是怎么改变在WPF你的主窗口的位置 - 在Windows窗体中,你只需要重写的OnLoad(),并设置Form.Location和Form.Size适当。我想WPF也有类似的东西。

I don't know how you change the location of your main window in WPF - in Windows Forms you just override OnLoad() and set the Form.Location and Form.Size appropriately. I imagine WPF has something similar.

这篇关于如何在特定的监视器打开一个特定的地方WPF应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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