This forum is in archive mode. You will not be able to post new content.

Author Topic: [VB.NET] Move borderless forms (Good for selfmade skins)  (Read 3598 times)

0 Members and 1 Guest are viewing this topic.

Offline uNk

  • Knight
  • **
  • Posts: 197
  • Cookies: 9
    • View Profile
[VB.NET] Move borderless forms (Good for selfmade skins)
« on: March 31, 2011, 11:04:09 PM »
Put this code after "Public Class (Your Form name) line"

Code: [Select]
   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:

Code: [Select]
#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:


« Last Edit: March 31, 2011, 11:15:08 PM by uNk »

Offline Huntondoom

  • Baron
  • ****
  • Posts: 856
  • Cookies: 17
  • Visual C# programmer
    • View Profile
Re: [VB.NET] Move borderless forms (Good for selfmade skins)
« Reply #1 on: March 31, 2011, 11:28:26 PM »
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?
Aslong as you are connected to the internet, you'll have no privacy

Advanced Internet Search
Clean Up!

Offline ande

  • Owner
  • Titan
  • *
  • Posts: 2664
  • Cookies: 256
    • View Profile
Re: [VB.NET] Move borderless forms (Good for selfmade skins)
« Reply #2 on: April 01, 2011, 12:13:04 PM »
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 :)
if($statement) { unless(!$statement) { // Very sure } }
https://evilzone.org/?hack=true

Offline Huntondoom

  • Baron
  • ****
  • Posts: 856
  • Cookies: 17
  • Visual C# programmer
    • View Profile
Re: [VB.NET] Move borderless forms (Good for selfmade skins)
« Reply #3 on: April 01, 2011, 02:37:52 PM »
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)
Aslong as you are connected to the internet, you'll have no privacy

Advanced Internet Search
Clean Up!

 



Want to be here? Contact Ande, Factionwars or Kulverstukas on the forum or at IRC.