Recently I made (mostly out of curiosity) a borderless form. After making my own title bar which includes the title, and the three buttons(minimize, maximize and close), just like every normal Windows program. I also made the code for these buttons (just ask if you want to see the code).
However, I've noticed that there are no animations. What I mean is that, e.g. if I click the minimize button, there is no animation, the program instantly disappears (it doesn't close, the button works, but without an animation). This happens in all cases: When I open the program it instantly appears, when I close it, it instantly disappears.
Is there some sort of way to use these animations that standard Windows programs use?
It doesn't seem possible to have the animation effect on a borderless form. However, there are two possible workarounds.
Set the
FormBorderStyle
back to Sizable just before a Minimize or Restore, and then back to none aftewards.Use the
AnimateWindow
function instead. The animations tend to happen where the window is currently located. The functions can be applied to anyControl
, not just top level windows.Here is some sample code:
I know that this question has been asked over a year ago, but i had the same problem and found a very nice solution. Look at this repo at Github.
Add FormBase.cs and Native.cs to your project.
What you have to do is basically to create a Form, f.e. Main.cs and derive it from FormBase
Main.cs
I also removed line 147 in FormBase.cs, because my Form had rounded edges
//SetWindowRegion(m.HWnd, 0, 0, pos.cx, pos.cy);