EvilZone
Programming and Scripting => .NET Framework => Topic started by: uNk on March 31, 2011, 11:04:09 PM
-
Put this code after "Public Class (Your Form name) line"
Dim Point As New System.Drawing.Point()
Dim U, N As Integer
Private Sub Main_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
If e.Button = MouseButtons.Left Then
Point = Control.MousePosition
Point.X = Point.X - (U)
Point.Y = Point.Y - (N)
Me.Location = Point
End If
End Sub
Private Sub Main_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
U = Control.MousePosition.X - Me.Location.X
N = Control.MousePosition.Y - Me.Location.Y
End Sub
Private Sub Sub_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs)
If e.Button = MouseButtons.Left Then
Point = Control.MousePosition
Point.X = Point.X - (U)
Point.Y = Point.Y - (N)
Me.Location = Point
End If
End Sub
Private Sub Sub_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs)
U = Control.MousePosition.X - Me.Location.X
N = Control.MousePosition.Y - Me.Location.Y
End Sub
You may also add these tags so you can minimize/hide the code snippet in case it confuses you:
#Region "what ever"
CODE HERE
#End Region
The results of this is that you can move forms that has the option "FormBorderStyle: None" chosen so you can make your own Photoshop background and add your own buttons like this:
(http://ploader.net/files/0c7f21674b2e64f08db6aa3be3fa3d2b.png)
-
yes Thanks A lot!
I was busy making an own Form but I failed at some point, so this will be great :P
do you have any snippets on resizing the Custom Form?
-
Neat, this can easely be added to a custom border thingy to, just make a panel or transparent button or something and add this code to its mouseup/down :)
-
Neat, this can easely be added to a custom border thingy to, just make a panel or transparent button or something and add this code to its mouseup/down :)
Okay Thanks for the advice, something may appear in the Zone Releases :P (in the next few days)