Win11软件全屏后遮挡住底下任务栏

如题,不知道为什么我的电脑突然就出现了这个bug,可能是因为电脑连续运行了好久了没有关机= =
这让我极度不适应,任务栏被挡住之后,存在各种麻烦,微信消息看不到了,切换窗口不方便了等等等等。
在CSDN搜了不少,感觉各种各样的解决思路都有,有的调显卡驱动出来设置的、有的扯一堆看电影全屏的、有的甚至重装系统的…离离原上谱…

下面说我的解决办法供各位尝试
1、底部任务栏右键打开任务管理器
任务管理器页面
2、然后选中任务管理器,右键结束任务
3、瞬间痊愈,喜大普奔~

要实现WinForm窗口全屏显示并隐藏下方任务栏,我们可以按照以下步骤进行操作: 1. 将窗口的BorderStyle属性设置为None,这样可以去掉窗口的标题栏和边框。 2. 使用窗口WindowState属性将窗口最大化,即将其状态设置为Maximized。 3. 在窗口加载时,使用Screen类的PrimaryScreen属性获取主屏幕的大小信息。 4. 获取任务栏的高度,可以使用Screen类的WorkingArea属性的Height属性减去Screen类的PrimaryScreen属性的Height属性来计算。 5. 将窗口的Height属性设置为主屏幕的Height减去任务栏的高度,这样窗口就可以全屏显示了。 6. 在窗口的VisibleChanged事件中,使用Win32 API函数FindWindow和ShowWindow来隐藏任务栏。 下面是示例代码,实现了窗口全屏显示并隐藏任务栏: ```c# using System; using System.Runtime.InteropServices; using System.Windows.Forms; namespace FullScreenApp { public partial class MainForm : Form { // 引入Win32 API函数 [DllImport("user32.dll")] private static extern IntPtr FindWindow(string className, string windowName); [DllImport("user32.dll")] private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); // 窗口消息常量 private const int SW_HIDE = 0; private const int SW_SHOW = 1; public MainForm() { InitializeComponent(); } private void MainForm_Load(object sender, EventArgs e) { // 窗口最大化 WindowState = FormWindowState.Maximized; // 获取主屏幕大小和任务栏高度 int screenWidth = Screen.PrimaryScreen.Bounds.Width; int screenHeight = Screen.PrimaryScreen.Bounds.Height; int taskbarHeight = Screen.PrimaryScreen.Bounds.Height - Screen.PrimaryScreen.WorkingArea.Height; // 全屏显示窗口 Height = screenHeight - taskbarHeight; } private void MainForm_VisibleChanged(object sender, EventArgs e) { // 隐藏任务栏 IntPtr taskbarHandle = FindWindow("Shell_TrayWnd", null); ShowWindow(taskbarHandle, SW_HIDE); } } } ``` 使用以上的代码和步骤,我们就可以将WinForm窗口全屏显示,并在显示窗口时隐藏下方任务栏
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值