开发者

Stretch a WPF window across two screens

开发者 https://www.devze.com 2023-03-08 10:18 出处:网络
I am a beginner in WPF. I want my application to stretch across two screens which have the same resolution.

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
0

精彩评论

暂无评论...
验证码 换一张
取 消