Screen.FromControl,
Screen.FromPoint并
Screen.FromRectangle应对此有所帮助。例如,在WinForms中,它将是:
class MyForm : Form{ public Rectangle GetScreen() { return Screen.FromControl(this).Bounds; }}我不知道WPF的等效要求。因此,您需要执行类似此扩展方法的操作。
static class ExtensionsForWPF{ public static System.Windows.Forms.Screen GetScreen(this Window window) { return System.Windows.Forms.Screen.FromHandle(new WindowInteropHelper(window).Handle); }}


