Is there an event in WinForms that get's fired when a window is dragged?
Or is there a better way of doing what I want: to drop the window opacity to 80% when the window is being dragged around?
Unfortunately this is stupidly tricky to search for because everyone is looking for drag and drop from the shell, or some other object.
It's the
LocationChanged
event you want:You'll have to override
WndProc
and handle the exit move event to reset the opacity back to 1:Not forgetting to define the message code:
It might be more efficient to handle the
WM_ENTERSIZEMOVE
(code0x0231
) message instead ofLocationChanged
as this would only result in setting the opacity once (at the start of the drag) rather than continually throughout the drag.No need for WndProc hacking, this works fine:
Moves also trigger the OnResizeXxx events.