I have tried to create a custom border less form for my application. I decided that it had to be resizable, so I put 8 panels on its sides (4 corners, 4 sides actually) and created code which will resize my form when called. Like, for example:
private void E_MouseDown(object sender, MouseEventArgs e)
{
Active = true;
}
private void East_MouseMove(object sender, MouseEventArgs e)
{
if (Active)
{
this.Size = new Size(this.Width + e.Location.X, this.Height);
this.Refresh();
}
}
private void E_MouseUp(object sender, MouseEventArgs e)
{
Active = false;
}
Unfortunately, the resizing is slow, overloads the CPU and performs visual glitches even with double buffering for the form turned on. I have quite a bit of controls on my form. But what I have noticed is the fact that when I switch to a standard border (like Sizable
), and DWM handles the window chrome, resizing is perfect. No glitches, stuttering and flicker. So I came to wonder, how does Windows manage to do? Is there a way to simulate what it is doing via the 8 panels? I hate when it flickers and it halts my project for no reason. The fact is that I worked all day long to mimic the Visual Studio 2013 window chrome and nearly suceeded, there is just this annoying problem... Can you help, please?
Thanks.