Link to home
Start Free TrialLog in
Avatar of schenkp
schenkp

asked on

Stopping a Form from being Dragged

HI,
I have a form that is set for FixToolWindows, but i can still drag it around the screen, i don’t want the user to have this ability but i want to keep this setting….

What do I change to have this happen?
Avatar of Agarici
Agarici
Flag of Romania image

add this to your form code :
        protected override void WndProc(ref Message m)
        {
            if ( m.Msg == 0x0084/*WM_NCHITTEST*/ )
                return;
            base.WndProc(ref m);
        }
hth,
A.
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AlexFM
AlexFM

Agarici, your version prevents form from closing by clicking x button. However, if form doesn't have Close button, it is OK.