How to set the location of WPF window to the bottom right corner of desktop?

后端 未结 7 2014
太阳男子
太阳男子 2020-12-07 20:39

I want to show my window on top of the TaskBar\'s clock when the windows starts.

How can I find the bottom right corner location of my desktop?

7条回答
  •  青春惊慌失措
    2020-12-07 21:07

    My code:

    MainWindow.WindowStartupLocation = WindowStartupLocation.Manual;
    
    MainWindow.Loaded += (s, a) =>
    {
        MainWindow.Height = SystemParameters.WorkArea.Height;
        MainWindow.Width = SystemParameters.WorkArea.Width;
        MainWindow.SetLeft(SystemParameters.WorkArea.Location.X);
        MainWindow.SetTop(SystemParameters.WorkArea.Location.Y);
    };
    

提交回复
热议问题