Public Class Form2
    Public mButton As Boolean
    Dim mox As Integer
    Dim moy As Integer

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        mButton = False
        'Me.TransparencyKey = ColorTranslator.FromOle(RGB(200, 200, 200))
    End Sub

    Private Sub Form2_MouseDoubleClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDoubleClick
        ' Me.Size = New Size(4000, 4)
        Me.Left = 0
        Me.Width = 4000
        'Me.Height = 4
        'Me.WindowState = FormWindowState.Normal
    End Sub

    Private Sub Form2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        mButton = True
        mox = e.X
        moy = e.Y
        If e.Button = Windows.Forms.MouseButtons.Right Then
            If Form1.WindowState = FormWindowState.Minimized Then
                Form1.WindowState = FormWindowState.Normal
                'Form1.Top = Me.Top + 10
                'Form1.Left = Me.Left + 20
            Else
                'check the stage color
                'set it to hidden of the same color
                If Me.TransparencyKey = Form1.LightColorS Then
                    Me.TransparencyKey = Form1.LightColorH
                Else
                    Me.TransparencyKey = Form1.DarkColorH
                End If
                'must now fix all the tracking variables. Since we cant tell what stage number was clicked on.
                'maybe in the future, each stage can be given a tag or name during creation..
                'this would allow a test to find out what stage it was, and then set the variable from here.
                Call Form1.FixSeeStage()
                'Timer1.Enabled = True
            End If
        End If
    End Sub



    Private Sub Form2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
        Dim mpx As Integer
        Dim mpy As Integer
        Dim newx As Integer
        Dim newy As Integer
        If mButton = True Then
            mpx = MousePosition.X
            mpy = MousePosition.Y
            newx = mpx - mox
            newy = mpy - moy
            'If MouseButtons = Windows.Forms.MouseButtons.Left Then
            'MsgBox(Me.Left & "   " & MousePosition.X & "    " & e.X & "     " & MousePosition.X - e.X)
            'End If
            Me.Left = newx
            Me.Top = newy
            If Form1.WindowState <> FormWindowState.Minimized Then
                'Form1.Top = Me.Top + 10
                'Form1.Left = Me.Left + 20
            End If

        End If
    End Sub

    Private Sub Form2_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
        mButton = False
    End Sub

    Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
        Timer1.Enabled = False
        'Form1.Close()
    End Sub
End Class