在多屏幕环境中最大化窗口,不隐藏/阻断任务栏 [英] Maximizing a window in a multi-screen environment without hiding/blocking the task bar

查看:208
本文介绍了在多屏幕环境中最大化窗口,不隐藏/阻断任务栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个后大家谁曾经问自己我怎么最大限度地在我的多屏设置窗口而不阻塞任务栏。

This is a post to everyone who has ever asked himself "how do I maximize a window in my multi-screen setup without blocking the task bar".

这个问题似乎是有 MaximizeBox MinimizeBox 设置为false,并且被编程最大化在多屏幕环境覆盖了整个窗口屏幕,不仅在 Screen.WorkingArea

The problem seems to be that a window that has MaximizeBox and MinimizeBox set to false and that gets maximized programmatically in a multi-screen environment covers the entire screen, not only the Screen.WorkingArea.

要最大化窗口只工作区中,人们需要利用 MaximizeBox MinimizeBox 像这样的属性:

To maximize a window to the working area only, one needs to utilize the MaximizeBox and MinimizeBox properties like so:

// This code should be placed in the Form's ResizeEnd handler

MaximizeBox = MinimizeBox = true;           // Enable both boxes
WindowState = FormWindowState.Maximized;    // Set to maximized
MaximizeBox = MinimizeBox = false;          // Disable both boxes again

因此​​,该窗口将被很好地最大化在屏幕上,尊重屏幕的工作区(不阻塞任务栏)。

Thus, the window will be nicely maximized on the screen and respect the screen's working area (not block the task bar).

推荐答案

或者你可以设置this.MaximumSize为新的大小(screen.primaryscreen.bounds.width + screen.secondaryscreen.bounds.width,screen.primaryscreen.bounds。高度)。

Or you could set this.MaximumSize to new Size (screen.primaryscreen.bounds.width + screen.secondaryscreen.bounds.width, screen.primaryscreen.bounds.height).

P.S。我写这从我的手机,所以我不能检查语法等等,也是你为什么要发布此为问题?

P.S. I wrote this from my phone so I cannot check syntax etc... and also why did you post this as a 'question'?

这篇关于在多屏幕环境中最大化窗口,不隐藏/阻断任务栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆