SharpUrBrain
SharpUrBrain

Reputation: 3230

DropShadow effect for Winform is slow?

I am applying Drop Shadow effect to my borderless win Form by overriding the CreateParams property and it works fine also but I don't know why it slow down the application while I am moving the Form.

My Code:

 private const int CS_DROPSHADOW = 0x20000;
    protected override CreateParams CreateParams
    {
        get
        {
              CreateParams parameters = base.CreateParams;
              if (OSFeature.IsPresent(SystemParameter.DropShadow))
              {
                  parameters.ClassStyle |= CS_DROPSHADOW;
              }
              return parameters;
        }
    }

Upvotes: 0

Views: 646

Answers (1)

James Johnston
James Johnston

Reputation: 9492

CS_DROPSHADOW creates a region of transparency. It takes a lot more time to blend the drop shadow with whatever might be underneath and then render it. This is especially true on Windows 2000/XP. I think they improved performance for transparency in Windows Vista/7.

This style was originally intended for things like menus, which can't be moved by the user. The performance of CS_DROPSHADOW was therefore probably not a major concern, either.

Upvotes: 2

Related Questions