How do I know what monitor a WPF window is in

前端 未结 6 1676
攒了一身酷
攒了一身酷 2020-12-01 12:11

In a C# application, how can I find out if a WPF window is in the primary monitor or another monitor?

6条回答
  •  抹茶落季
    2020-12-01 12:38

    Check out How do I find what screen the application is running on in C#
    Also Run Application on a Dual Screen Environment has an interesting solution:

    bool onPrimary = this.Bounds.IntersectsWith(Screen.PrimaryScreen.Bounds);
    

    where "this" is the main form of your application.

提交回复
热议问题