Home > other >  C # WinForm without borders window maximize, minimize the animation
C # WinForm without borders window maximize, minimize the animation

Time:01-17

After the WinForm FormBorderStyle set to None, although the window without a border, but the maximization of system at how do have to minimize the animation? I know this can be achieved, because Visual Studio can do this, but I don't know what is the principle,

CodePudding user response:

Can adjust back, minimize the clocks back again after

 this. FormBorderStyle=FormBorderStyle. Sizable; 
Enclosing WindowState=FormWindowState. Minimized;
Enclosing FormBorderStyle=FormBorderStyle. None;

Animation, but this will affect the interface can be defined a Boolean as a lock to control,
The AnimateWindow function before and after adding:
 animLock=true; 
AnimateWindow (this Handle, 400, AW_ACTIVE | AW_VER_POSITIVE);
AnimLock=false;

Then before the code can be changed to:
 if (animLock) 
{
return;
}
Enclosing FormBorderStyle=FormBorderStyle. Sizable;
Enclosing WindowState=FormWindowState. Minimized;
Enclosing FormBorderStyle=FormBorderStyle. None;

CodePudding user response:

Oh, and minimize from the task bar to activate the animation after solution:
Monitor window Activated event, the code is as follows:
 private void MainForm_Activated (object sender, EventArgs e) 
{
Console. WriteLine (" MainForm_Activated ");
If (animLock)
{
return;
}
Enclosing FormBorderStyle=FormBorderStyle. Sizable;
Enclosing WindowState=FormWindowState. Normal;
Enclosing FormBorderStyle=FormBorderStyle. None;
}


The above methods will flash because to layout, animation is, flash, blink, also don't know how to solve
  • Related