Make a custom window design in visual basic
08-05-2011, 05:57 PM,
#1
Make a custom window design in visual basic
I am a visual basic programmer so I decited to share some of my knowlege with you. I will tell you how to make a custom window design.
Ok it is very simple... First of all, change the FormBorgerStyle to none. Then add a panel. Now add this code after the Private Class Form1 :
Code:
Dim A As New System.Drawing.Point()
    Dim x, y As Integer
    Dim i As String = 0
    Private Sub Panel1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown
        x = Control.MousePosition.X - Me.Location.X
        y = Control.MousePosition.Y - Me.Location.Y
    End Sub
    Private Sub Panel1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove
        If e.Button = MouseButtons.Left Then
            A = Control.MousePosition
            A.X -= (x)
            A.Y -= (y)
            Me.Location = A
        End If
    End Sub
What is this doing?
This move the form when you hold and move the panel you endered...
Now add three picturebox which will minimize,maximize and close the form...
- To the picturebox that will minimize the form add this code :
Code:
Me.WindowState = FormWindowState.Minimized
- To the picturebox that will maximize the form add the this code :
Code:
i = i + 1
        If i = 1 Then
            Me.WindowState = FormWindowState.Maximized
        End If
        If i = 2 Then
            Me.WindowState = FormWindowState.Normal
            i = 0
        End If
and the code "Dim i As String = 0" after the Private Class Form1.

- To the picturebox that will close the form add the this code :
Code:
End
That’s it!!!

If you have problem to create your custom form design download an example I have made for you :
http://adf.ly/18UqS

If you have any question ask me here! :)
Reply


Forum Jump: