1
votes

I'm creating a form with FormBorderStyle set to None.

I am using the following to enable Aero Snapping:

protected override CreateParams CreateParams
{
  get
  {
    CreateParams cp = base.CreateParams;
    {
      cp.Style |= 0x20000 | 0x80000 | 0x40000; //WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX;
    }
     return cp;
  }
}

This works fine except it creates two issues.

  1. I now have a white border on the top of my form that I cannot remove. screenshot
  2. When I snap the form to the top of the screen, it fills the entire screen, covering the taskbar.

I am definitely a beginner at this so any help would be very much appreciated.

1

1 Answers

0
votes

For the second point there is a solution. But I have the same problem with the first one. Here is the solution: MaximizedBounds = Screen.FromHandle(Handle).WorkingArea;