Question How to drag a borderless window

efadrian

New member
Joined
Jan 5, 2010
Messages
4
Location
Romania
Programming Experience
Beginner
Hi,
I have a border-less window made by this function:
VB.NET:
Private Sub MiniWin()
        Me.Visible = False
        Me.Text = ""
        Me.ControlBox = False
        Me.FormBorderStyle = Windows.Forms.FormBorderStyle.SizableToolWindow
        Me.Width = 320
        Me.Height = 240
        Me.StartPosition = FormStartPosition.Manual
        Me.Left = Screen.PrimaryScreen.Bounds.Height - 100
        Me.Top = 25
        Me.TopMost = True
        mp.uiMode = "none"
        mp.Dock = DockStyle.Fill
        Me.Visible = True
    End Sub

and when is in this state I can't move it... so how can I move the form when is in this condition?

Second Q: how can I forbid the window form not to be re-size-ble and stay within the given dimensions?
thank you!
adrian...
 
Quick Googling brought up this link. Worked fine when I tested it.

VB.NET:
	Const WM_NCHITTEST As Integer = &H84
	Const HTCLIENT As Integer = &H1
	Const HTCAPTION As Integer = &H2
	Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
		Select Case m.Msg
			Case WM_NCHITTEST
				MyBase.WndProc(m)
				If m.Result = HTCLIENT Then m.Result = HTCAPTION
			Case Else
				MyBase.WndProc(m)
		End Select
	End Sub
 
Back
Top