When you create a Form with a border, Windows automatically draws a drop shadow around the form, as shown here:

Border form with shadow

However, if you set the form’s FormBorderStyle property to None, Windows draws neither the form border nor the drop shadow, as shown here:

Borderless form with no shadow

So what if you don’t want a form border, but you do want a drop shadow?

Borderless form with shadow

The solution is easy.  Just add the following code to your Form class:

private const int CS_DROPSHADOW = 0x20000;
protected override CreateParams CreateParams
{
    get
    {
        CreateParams cp = base.CreateParams;
        cp.ClassStyle |= CS_DROPSHADOW;
        return cp;
    }
}

Popularity: 3% [?]

Related posts:

  1. Hide Form from Alt+Tab
  2. C# Focus TextBox on Form Load
  3. C# WinForms Form Event Order
  4. Convert Handle to Form, and Vice Versa
  5. The Proper Way to Show the Wait Cursor