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

后端 未结 2 877
清酒与你
清酒与你 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:31

    In case Matthew Watson's answer doesn't work, your window may be in Maxmized state. In this case, set its state to WindowState.Normal, change top/left and revert the WindowState.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题