Stretch a WPF window across two screens
I am a beginner in WPF. I want my application to stretch across two screens which have the same resolution.
I need a sample code application, because I don't know where I can start.Than开发者_StackOverflow中文版k you
The Screen
class will provide you with information about all the screens. Without having actually done it before, I'd try something like:
int windowPosX = Screen.PrimaryScreen.WorkingArea.Left;
int windowPosY = Screen.PrimaryScreen.WorkingArea.Top;
int windowWidth = Screen.PrimaryScreen.WorkingArea.Width;
int windowHeight = Screen.PrimaryScreen.WorkingArea.Height;
foreach (Screen s in Screen.AllScreens)
if (!s.Primary)
windowWidth += s.Bounds.Width;
// Set the window's left, top, width and height properties accordingly
精彩评论