How to set WPF window position in secondary display

后端 未结 3 2050
栀梦
栀梦 2020-12-15 18:46

I have two displays. I want to make a media player and I want to play video full screen on my secondary display. So I’m trying to make a media player using WPF

Here

3条回答
  •  悲哀的现实
    2020-12-15 19:18

    You need to make sure that the WindowStartupLocation is set to Manual for the form you are displaying

    Otherwise nothing you do will have any effect on the position of the window.

    using System.Windows.Forms;
    // reference System.Drawing
    //
    
    Screen s = Screen.AllScreens[1];
    
    System.Drawing.Rectangle r  = s.WorkingArea;
    Me.Top = r.Top;
    Me.Left = r.Left;
    

    This header of the XAML of the Window I used.

    
        
            //Controls etc
        
    
    

提交回复
热议问题