Imports System.Runtime.InteropServices
Public Class LoginForm
#Region "FORM BEHAVIORS"
    Private Sub btncerrar_Click(sender As Object, e As EventArgs) Handles btncerrar.Click
        Application.Exit()
    End Sub
    Private Sub btnminimizar_Click(sender As Object, e As EventArgs) Handles btnminimizar.Click
        Me.WindowState = FormWindowState.Minimized
    End Sub
#End Region

#Region "DRAG FORM"
    '----------------ARRASTRAR FORMULARIO
    <DllImport("user32.DLL", EntryPoint:="ReleaseCapture")>
    Private Shared Sub ReleaseCapture()
    End Sub

    <DllImport("user32.DLL", EntryPoint:="SendMessage")>
    Private Shared Sub SendMessage(ByVal hWnd As System.IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer)
    End Sub
    Private Sub TitleBar_MouseMove(sender As Object, e As MouseEventArgs) Handles TitleBar.MouseMove
        ReleaseCapture()
        SendMessage(Me.Handle, &H112&, &HF012&, 0)
    End Sub
#End Region

#Region "CUSTOMIZE CONTROLS"
    Private Sub CustomizeComponents()
        'Txt user
        txt_usuario.AutoSize = False
        txt_usuario.Size = New Size(312, 20)
        'Txt password
        txt_usuario.AutoSize = False
        txt_usuario.Size = New Size(312, 20)
        txt_contraseña.UseSystemPasswordChar = True
    End Sub
#End Region

    Private Sub Button1_Paint(sender As Object, e As PaintEventArgs) Handles Button1.Paint
        Dim buttonPath As Drawing2D.GraphicsPath = New Drawing2D.GraphicsPath()
        Dim myRectangule As Rectangle = Button1.ClientRectangle
        myRectangule.Inflate(0, 30)
        buttonPath.AddEllipse(myRectangule)
        Button1.Region = New Region(buttonPath)
    End Sub

    Public Sub New()

        ' Llamada necesaria para el diseñador.
        InitializeComponent()

        ' Agregue cualquier inicialización después de la llamada a InitializeComponent().
        CustomizeComponents()
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Module1.usuario = txt_usuario.Text
        Dim password As String
        password = txt_contraseña.Text
        If Len(Trim(txt_usuario.Text)) = 0 Or Len(Trim(txt_contraseña.Text)) = 0 Then
            MsgBox("Debe especificar el nombre y la contraseña de usuario")
        ElseIf usuario = "OColunga" And password = "hola" Or usuario = "Dione" And password = "calidad" Then
            Me.Hide()
            FormBienvenida.Show()
        Else
            MsgBox("La contraseña y/o el nombre son incorrectos")
        End If
    End Sub

End Class
