I have a non-rectangle form without title/caption bar. I wanna allow user to move the form by clicking on anywhere on the form and move it, how do i do that?
Thanks for the help! :)
Printable View
I have a non-rectangle form without title/caption bar. I wanna allow user to move the form by clicking on anywhere on the form and move it, how do i do that?
Thanks for the help! :)
You are going to probably have to use the mouse down event to enter a loop that polls where the mouse is and move the form.
this is what i will do...
but i dunno how to do this...Code:Trap MouseDown:
set a flag stating the mouse is depressed, set the current
position of mouse (properties on the MouseEventArgs object).
Trap MouseMove:
if flag is set, calculate the difference in the current position of the
mouse & the previous position of the mouse and move the form
accordingly. Set previous location to current location.
Trap Mouseup: toggle the flag.
set the current
position of mouse (properties on the MouseEventArgs object)
Trap MouseMove: if flag is set, calculate the difference in the
current position of the mouse & the previous position of the
mouse and move the form accordingly. Set previous location to
current location.
Maybe there is an equivalent in C# of catching WM_NCHITTEST?
In any case, you could override PreProcessMessage.