Public Class frmTool_ControlDesigner
    Dim MouseIsDown As Boolean = False
    Private Shared _Instance As frmTool_ControlDesigner = Nothing
    Public Shared Function Instance() As frmTool_ControlDesigner
        If _Instance Is Nothing OrElse _Instance.IsDisposed = True Then
            _Instance = New frmTool_ControlDesigner
        End If
        _Instance.BringToFront()
        Return _Instance
    End Function
    Private Sub btncontrol_MouseDown(sender As Object, e As MouseEventArgs) Handles btntextbox.MouseDown,
                                                                                    btnTabelle.MouseDown,
                                                                                    btnlabel.MouseDown,
                                                                                    btndtp.MouseDown,
                                                                                    btncmb.MouseDown,
                                                                                    btnCheckbox.MouseDown,
                                                                                    btnpb.MouseDown,
                                                                                    btngb.MouseDown,
                                                                                    btn_addtocal.MouseDown,
                                                                                    btn_addformdata.MouseDown,
                                                                                    btnRadioButton.MouseDown,
                                                                                    btnListBoxCheckable.MouseDown,
                                                                                    btnListBox.MouseDown
        MouseIsDown = True
    End Sub
    Private Sub btnlabel_MouseMove(sender As Object, e As MouseEventArgs) Handles btnlabel.MouseMove
        If MouseIsDown Then
            'Initiate dragging. 
            btnlabel.DoDragDrop("lbl", DragDropEffects.Copy)
        End If
        MouseIsDown = False
    End Sub

    Private Sub btndtp_MouseMove(sender As Object, e As MouseEventArgs) Handles btndtp.MouseMove
        If MouseIsDown Then
            'Initiate dragging. 
            btndtp.DoDragDrop("dtp", DragDropEffects.Copy)
        End If
        MouseIsDown = False
    End Sub

    Private Sub btntextbox_MouseMove(sender As Object, e As MouseEventArgs) Handles btntextbox.MouseMove
        If MouseIsDown Then
            'Initiate dragging. 
            btntextbox.DoDragDrop("txt", DragDropEffects.Copy)
        End If
        MouseIsDown = False
    End Sub

    Private Sub btnCheckbox_MouseMove(sender As Object, e As MouseEventArgs) Handles btnCheckbox.MouseMove
        If MouseIsDown Then
            'Initiate dragging. 
            btnCheckbox.DoDragDrop("chk", DragDropEffects.Copy)
        End If
        MouseIsDown = False
    End Sub

    Private Sub btncmb_MouseMove(sender As Object, e As MouseEventArgs) Handles btncmb.MouseMove
        If MouseIsDown Then
            'Initiate dragging. 
            btncmb.DoDragDrop("cmb", DragDropEffects.Copy)
        End If
        MouseIsDown = False
    End Sub

    Private Sub btnTabelle_MouseMove(sender As Object, e As MouseEventArgs) Handles btnTabelle.MouseMove
        If MouseIsDown Then
            'Initiate dragging. 
            btnTabelle.DoDragDrop("dgv", DragDropEffects.Copy)
        End If
        MouseIsDown = False
    End Sub

    Private Sub btnpb_MouseMove(sender As Object, e As MouseEventArgs) Handles btnpb.MouseMove
        If MouseIsDown Then
            btnpb.DoDragDrop("pb", DragDropEffects.Copy)
        End If
        MouseIsDown = False
    End Sub

    Private Sub btngb_MouseMove(sender As Object, e As MouseEventArgs) Handles btngb.MouseMove
        If MouseIsDown Then
            btngb.DoDragDrop("gb", DragDropEffects.Copy)
        End If
        MouseIsDown = False
    End Sub

    Private Sub btn_addtocal_MouseMove(sender As Object, e As MouseEventArgs) Handles btn_addtocal.MouseMove
        If MouseIsDown Then
            btn_addtocal.DoDragDrop("f_addappointment", DragDropEffects.Copy)
        End If
        MouseIsDown = False
    End Sub

    Private Sub btn_addformdata_MouseMove(sender As Object, e As MouseEventArgs) Handles btn_addformdata.MouseMove
        If MouseIsDown Then
            btn_addformdata.DoDragDrop("f_addformdata", DragDropEffects.Copy)
        End If
        MouseIsDown = False
    End Sub
    Private Sub btnRadioButton_MouseMove(sender As Object, e As MouseEventArgs) Handles btnRadioButton.MouseMove
        If MouseIsDown Then
            btn_addformdata.DoDragDrop("rb", DragDropEffects.Copy)
        End If
        MouseIsDown = False
    End Sub

    Private Sub frmTool_FormDesigner_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
        Try
            ClassWindowLocation.SaveFormLocationSize(Me, 1, CURRENT_SCREEN_ID, "frmTool_FormDesigner")
            My.Settings.Save()
        Catch ex As Exception
            MsgBox("Settings could not be saved.\n" & ex.ToString)
        End Try
    End Sub

    Private Sub frmTool_FormDesigner_Load(sender As Object, e As EventArgs) Handles Me.Load
        ClassWindowLocation.LoadFormLocationSize(Me, 1, CURRENT_SCREEN_ID, "frmTool_FormDesigner")

    End Sub

    Private Sub btnListBox_MouseMove(sender As Object, e As MouseEventArgs) Handles btnListBoxCheckable.MouseMove
        If MouseIsDown Then
            'Initiate dragging. 
            btnListBoxCheckable.DoDragDrop("lstbxcheck", DragDropEffects.Copy)
        End If
    End Sub

    Private Sub btnListBox_MouseMove_1(sender As Object, e As MouseEventArgs) Handles btnListBox.MouseMove
        If MouseIsDown Then
            'Initiate dragging. 
            btnListBox.DoDragDrop("lstbx", DragDropEffects.Copy)
        End If
    End Sub

    Private Sub frmTool_ControlDesigner_Shown(sender As Object, e As EventArgs) Handles Me.Shown
        If Me.WindowState = FormWindowState.Maximized Then
            Me.WindowState = FormWindowState.Normal
        End If
    End Sub
End Class