// Considering space for Taskbar at the bottom.
MONITORINFO monitorInfo = new MONITORINFO();
int MONITOR_DEFAULTTONEAREST = 0x00000001;
System.IntPtr handle = (new WinInterop.WindowInteropHelper(this)).Handle;
System.IntPtr monitor = MonitorFromWindow(handle, MONITOR_DEFAULTTONEAREST);
GetMonitorInfo(monitor, monitorInfo);
RECT rcWorkArea = monitorInfo.rcWork;
RECT rcMonitorArea = monitorInfo.rcMonitor;
M.Height = Math.Abs(rcWorkArea.bottom - rcWorkArea.top);// SystemParameters.MaximizedPrimaryScreenHeight - 20;
M.Width = SystemParameters.MaximizedPrimaryScreenWidth - 15;
M.Top = 0; M.Left = 0;
#region Win32 API
[DllImport("user32")]
internal static extern bool GetMonitorInfo(IntPtr hMonitor, MONITORINFO lpmi);
///
///
///
[DllImport("User32")]
internal static extern IntPtr MonitorFromWindow(IntPtr handle, int flags);
#endregion
Saturday, April 21, 2012
Show WPF Form considering taskbar
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment