当前位置:网站首页>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
边栏推荐
- [proteus simulation] example of using timer 0 as a 16 bit counter
- svg+js键盘控制路径
- Scala IO reads binary files
- Ten commandments of self-learning in machine learning
- I suddenly find that the request dependent package in NPM has been discarded. What should I do?
- In the past 5 years, from "Diandian" to the current test development, my success is worth learning from.
- Zed acquisition
- vim使用命令
- C程序设计专题 15-16年期末考试习题解答(上)
- 信号完整性(SI)电源完整性(PI)学习笔记(一)信号完整性分析概论
猜你喜欢

Power application of 5g DTU wireless communication module

After 5 years of software testing in didi and ByteDance, it's too real

One way 和two way ANOVA分析的区别是啥,以及如何使用SPSS或者prism进行统计分析

Eye gaze estimation using webcam

Reservoir dam safety monitoring

Tremblement de terre réel ~ projet associé unicloud

Time unified system

Creative SVG ring clock JS effect

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

∞ symbol line animation canvasjs special effect
随机推荐
Current situation and development prospect forecast report of global and Chinese tetrahydrofurfuryl alcohol acetate industry from 2022 to 2028
Tiktok practice ~ project associated unicloud
离散数学及其应用 2018-2019学年春夏学期期末考试 习题详解
VR全景制作的优势是什么?为什么能得到青睐?
Difficult and miscellaneous problems: A Study on the phenomenon of text fuzziness caused by transform
Wx applet jump page
Window system installation Nacos
SAP PA certificate for no birds, which can be tested by new peers
MySQL problem points
JPA学习1 - 概述、JPA、JPA核心注解、JPA核心对象
Tiktok actual combat ~ sorting out the short video release process
The file containing the file operation vulnerability (6)
Number of bytes corresponding to common data types
Hello C (III) - pointer
Outer screen and widescreen wasted? Harmonyos folding screen design specification teaches you to use it
Analysis report on operation pattern and supply and demand situation of global and Chinese cyano ketoprofen industry from 2022 to 2028
水库大坝安全监测
Svg+js keyboard control path
Investment analysis and prospect forecast report of global and Chinese propargyl chloride industry from 2022 to 2028
How to use stm32subeide SWV function