How to open a WPF Application in a specific Place on a Specific Monitor

后端 未结 2 912
清酒与你
清酒与你 2021-01-23 14:50

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 op

2条回答
  •  我在风中等你
    2021-01-23 15:51

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

    You need to do a couple of things:

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

    Screen[] allScreens = Screen.AllScreens;

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

    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.

提交回复
热议问题