Locking A Form

ZeroEffect

Junior Contributor
Joined
Oct 24, 2004
Messages
204
Location
Detroit, MI
Here is what I am trying to accompilish. I want to give the use the option to Lock the form on the screen so no one can move the form. I see there is a lock option when you view the form properties but it doesn't seem to be accessible by code. I have tried locking the position by the Move event on the form. This works to a point, you are still able to move and you see it snap into place. This is not visually pleasing. Does anyone have an idea on how to make this work.

Thanks

ZeroEffect
 
Why not change the form to a fixed dialog and set topmost to true

Visual Basic:
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedDialog
me.Topmost = true

Hope this helps
 
SonicBoomAu said:
Why not change the form to a fixed dialog and set topmost to true

Visual Basic:
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedDialog
me.Topmost = true

Hope this helps

Thats not a bad idea, but I'm looking more twards making the form non-movable. I might add your suggestion too.

Thanks for the idea.

ZeroEffect
 
You could always try handling the Move event and just reseting the position back, not sure how that would look though.

If it doesn't look too good the nyou might need to handle the WM_MOVE or similar messages yourself and just ignore them.
 
Back
Top