Page 1 of 1

Moving Boarderless forms w/ Picture boxs.?!?

Posted: Tue Mar 16, 2010 10:12 pm
by Livengood
Hey guys can someone tell me how would you move a boarderless form with a picture box :)

Re: Moving Boarderless forms w/ Picture boxs.?!?

Posted: Tue Mar 16, 2010 11:17 pm
by 35000vr
i have no idea.

Re: Moving Boarderless forms w/ Picture boxs.?!?

Posted: Tue Mar 16, 2010 11:45 pm
by hungryhounduk
If you put this code just below the public class "Public Class Form1":
............................................................................................
Code: Select all
Public Const WM_NCLBUTTONDOWN As Integer = &HA1
    Public Const HTCAPTION As Integer = &H2
    <Runtime.InteropServices.DllImport("User32.dll")> _
    Public Shared Function ReleaseCapture() As Boolean
    End Function
    <Runtime.InteropServices.DllImport("User32.dll")> _
    Public Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
    End Function

'And then in order to move your form put this code inside the "Form1_MouseDown" event:
...........................................................................................................................
Code: Select all
If e.Button = MouseButtons.Left Then
            ReleaseCapture()
            SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0)
        End If
.................................................................................................................................................................................
'That will let you move the form without a border . You can use it in picturebox_mousedown aswell for example if you wanted too.

Re: Moving Boarderless forms w/ Picture boxs.?!?

Posted: Wed Mar 17, 2010 1:46 am
by 35000vr
Wow,your good at coding hungryhound.

Re: Moving Boarderless forms w/ Picture boxs.?!?

Posted: Wed Mar 17, 2010 5:54 am
by Livengood
Thanks hungry :D

Re: Moving Boarderless forms w/ Picture boxs.?!?

Posted: Wed Mar 17, 2010 9:08 pm
by Lewis
Sorry for this post but, I dont think its allowed to post useless posts like ';)' and ':)' or just smiled things If you are going to post post something too read or nothing at all if you dissagree with this just delete it

Re: Moving Boarderless forms w/ Picture boxs.?!?

Posted: Thu Mar 18, 2010 3:05 pm
by hungryhounduk
Hi Livengood
Credit goes to Codenstuff for this Code :)