Fade Form on Move or Resize
I had a project where we display a form to a user and perform a certain task. Well the user wanted to be able to fade the form when they move it or resize it so they can see the underlying (Main) form. This is simple but thought since my blog has been out of date for some time now I should add something to it.
To get started, add the following to your form that you want to handle the fade or add to your constant class:
// Called when a Resize or Move loop has ended
const int WM_EXITSIZEMOVE = 0x0232;
// Called at the beginning of a Resize Move loop
const int WM_ENTERSIZEMOVE = 0x0231;
Next, override the WndProc method of your form like and handle the fade of your choice:
protected override void WndProc(ref Message m)
// Check if user is/isn't dragging the form
// Form is being Moved or Resized, set opacity
this.Opacity = 0.65;
// Form is done moving/resizing, set opacity back to 100%
this.Opacity = 1;
And thats it, when you move or resize the form the opacity will drop to 65%. Once the resizing or moving is complete the form will return to 100% opacity.