Is there a way to disable a user from dragging a form other than setting the form border style to "None" ?
Printable View
Is there a way to disable a user from dragging a form other than setting the form border style to "None" ?
Yes, you can remove the 'Move' option from the controlbox menu via some API's, which will disable moving. There's at least one codebank submission on this, I think it was from jmcilhinney but I'm not sure.
Ok ive set the Controlbox menu to "false" in the properties menu , that removes the minimize , maximize , close options on the form which is also helpful.
How do i access the controlbox menu itself to disable "move" ?
Yea its in c# , not vb
There's also a VB version here.
Also, you don't need to remove the controlbox completely if you don't want to. You can, of course, but it's not necessary as far as I know.
Ive found this one m8 , and it works perfect. thanks for your help on this;)
http://www.vbforums.com/showthread.p...ontrolbox+menu
Paste this into the form you want to prevent the drag on:
vb.net Code:
Protected Overrides Sub WndProc(ByRef m As Message) If (m.Msg = &H112) AndAlso (m.WParam.ToInt32() = &HF010) Then Return End If If (m.Msg = &HA1) AndAlso (m.WParam.ToInt32() = &H2) Then Return End If MyBase.WndProc(m) End Sub