muthuraman Posted October 16, 2003 Posted October 16, 2003 Hi, I would like to prevent the user from being able to drag my form window. I set the FormBorderStyle of the property of the form to 'none' but this removes the caption bar which I don't want. Can anyone help me?. Thanks Quote
JumpsInLava Posted October 16, 2003 Posted October 16, 2003 The only easy way I can think of to keep a form in place (if that is what you are looking for) is to do: Me.Top = 100 Me.Left = 100 In the forms Move event. Quote
muthuraman Posted October 16, 2003 Author Posted October 16, 2003 This wud work but the window would flicker. It is going to come to a position where you release your mouse and go back to 100, 100 after. Quote
JumpsInLava Posted October 16, 2003 Posted October 16, 2003 (edited) I like simple. I would just use this in the Form's Move event : Me.Top = 100 Me.Left = 100 Messagebox.show("Try that again, and I'll break your legs!") ...but since you want to be all difficult about it, I found this somewhere: Some a this up top: Imports System.Runtime.InteropServices And a lil this in the class: <StructLayoutAttribute(LayoutKind.Sequential)> _ Structure WM_MOVINGRECT Dim Left, Top, Right, Bottom As Integer End Structure Public Const WM_MOVING As Integer = &H216 Protected Overrides Sub WndProc(ByRef m As Message) If m.Msg = WM_MOVING Then Dim lParam As WM_MOVINGRECT = CType(m.GetLParam(GetType(WM_MOVINGRECT)), WM_MOVINGRECT) lParam.Left = Me.Left lParam.Top = Me.Top lParam.Right = Me.Right lParam.Bottom = Me.Bottom Marshal.StructureToPtr(lParam, m.LParam, True) End If MyBase.WndProc(m) End Sub Edited October 16, 2003 by JumpsInLava Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.