当前位置:网站首页>C WinForm maximizes occlusion of the taskbar and full screen display
C WinForm maximizes occlusion of the taskbar and full screen display
2022-06-25 00:07:00 【Xiongsiyu】
When you open the maximized form , If not configured , By default, the form is blocked by the taskbar , Some interfaces are invisible , See the effect of the following code , It may help you
Create a new one Winform project , Add three buttons , Add a click event to the three buttons

Code :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Test5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private Size WindowMaximumSize;
private void Form1_Load(object sender, EventArgs e)
{
WindowMaximumSize = this.MaximumSize;
this.TopMost = true;
}
private void button1_Click(object sender, EventArgs e)
{
// The taskbar will not be blocked
if (this.WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Normal;
}
else
{
this.WindowState = FormWindowState.Maximized;
}
}
private void button2_Click(object sender, EventArgs e)
{
// The taskbar will be blocked
if (this.WindowState == FormWindowState.Maximized)
{
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.WindowState = FormWindowState.Normal;
}
else
{
this.FormBorderStyle = FormBorderStyle.None;
this.MaximumSize = WindowMaximumSize;
this.WindowState = FormWindowState.Maximized;
}
}
private void button3_Click(object sender, EventArgs e)
{
// The taskbar will not be blocked
if (this.WindowState == FormWindowState.Maximized)
{
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.WindowState = FormWindowState.Normal;
}
else
{
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
this.WindowState = FormWindowState.Maximized;
}
}
}
}
effect :
Click button 1, Will maximize , But the form does not obscure the taskbar ,
Click button 2, It will be displayed in full screen ,
Click button 3, Will maximize , But the form does not obscure the taskbar ,
end
边栏推荐
- Investment analysis and prospect forecast report of global and Chinese propargyl chloride industry from 2022 to 2028
- 在滴滴和字节跳动干了 5年软件测试,太真实…
- Transition from digitalization to intelligent manufacturing
- Why do more and more physical stores use VR panorama? What are the advantages?
- 软件测试与游戏测试文章合集录
- Collective例子
- Common redis commands in Linux system
- Daily calculation (vowel case conversion)
- Hello C (I) -- basics of C language
- Analysis report on the "fourteenth five year plan" and development trend of China's engineering project management industry from 2022 to 2028
猜你喜欢

怎么把wps表格里某一列有重复项的整行删掉

5年,从“点点点”到现在的测试开发,我的成功值得每一个借鉴。

【面试题】什么是事务,什么是脏读、不可重复读、幻读,以及MySQL的几种事务隔离级别的应对方法

Tape SVG animation JS effect

Creative SVG ring clock JS effect

Hello C (I) -- basics of C language

The third generation of power electronics semiconductors: SiC MOSFET learning notes (V) research on driving power supply

Hibernate学习2 - 懒加载(延迟加载)、动态SQL参数、缓存

【排行榜】Carla leaderboard 排行榜 运行与参与手把手教学

磁带svg动画js特效
随机推荐
信号完整性(SI)电源完整性(PI)学习笔记(二十五)差分对与差分阻抗(五)
Ansible及playbook的相关操作
Transition from digitalization to intelligent manufacturing
Analysis report on development trend and investment forecast of global and Chinese D-leucine industry from 2022 to 2028
MySQL problem points
Investment analysis and prospect forecast report of global and Chinese octadecyl cyclopentanoate industry from 2022 to 2028
It's 2022, and you still don't know what performance testing is?
为什么生命科学企业都在陆续上云?
【排行榜】Carla leaderboard 排行榜 运行与参与手把手教学
Do280openshift access control -- encryption and configmap
canvas螺旋样式的动画js特效
vim使用命令
Dynamic effect of canvas lines
Outer screen and widescreen wasted? Harmonyos folding screen design specification teaches you to use it
What are the advantages of VR panoramic production? Why is it favored?
Why are life science enterprises on the cloud in succession?
Stm32f030f4 reading infrared remote control data
Signal integrity (SI) power integrity (PI) learning notes (I) introduction to signal integrity analysis
Daily calculation (vowel case conversion)
JPA learning 2 - core annotation, annotation addition, deletion, modification and query, list query result return type, one to many, many to one, many to many