You can set in constructor of your window an event handler for LocationChanged
:
this.LocationChanged += MainWindow_LocationChanged;
And check the monitor in the event handler:
private void MainWindow_LocationChanged(object sender, EventArgs e)
{
System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.FromHandle(new System.Windows.Interop.WindowInteropHelper(this).Handle);
//evaluate the screen variable
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…