Imports System.Drawing
Public Class ImpCtl
    Enum e_Valuetype
        문자 = 0
        숫자 = 1
        날짜 = 2
    End Enum

    Dim v필드명 As String
    Public Event TimeExpired(ByVal sender As Object, ByVal Status As String)

    ''' <summary>
    ''' 사용여부
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Overloads Property eNABLED() As Boolean
        Get
            Return Me.TextBox1.Enabled
        End Get
        Set(ByVal value As Boolean)
            Me.TextBox1.Enabled = value
            Me.Label1.Enabled = value
            Me.TextBox2.Enabled = value
            Me.CheckBox1.Enabled = value
            If value = False Then Me.Label1.Text = ".."
        End Set
    End Property

    ''' <summary>
    ''' 연결할 필드명입니다.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property 필드명() As String
        Get
            Return v필드명
        End Get
        Set(ByVal value As String)
            v필드명 = value
        End Set
    End Property

    Public Property Vtype() As Boolean
        Get
            Return Me.ComboBox1.Enabled
        End Get
        Set(ByVal value As Boolean)
            Me.ComboBox1.Enabled = value
        End Set
    End Property

    Public Property Valuetype() As e_Valuetype
        Get
            Return Me.ComboBox1.SelectedIndex
        End Get
        Set(ByVal value As e_Valuetype)
            Me.ComboBox1.SelectedIndex = 0
        End Set
    End Property
    Public Property 제목() As String
        Get
            Return Me.Label1.Text
        End Get
        Set(ByVal value As String)
            Me.Label1.Text = value.Replace("/", vbCrLf)
        End Set
    End Property
    Public Property 문자열자르기() As String
        Get
            Return Me.TextBox2.Text
        End Get
        Set(ByVal value As String)
            Me.TextBox2.Text = value
        End Set
    End Property
    Public Property 열번호() As String
        Get
            Return Me.TextBox1.Text
        End Get
        Set(ByVal value As String)
            Me.TextBox1.Text = value
        End Set
    End Property

    Public Property 빈값체크() As Boolean
        Get
            Return Me.CheckBox1.Checked
        End Get
        Set(ByVal value As Boolean)
            Me.CheckBox1.Checked = value

        End Set
    End Property


    Public Sub New()

        ' 이 호출은 Windows Form 디자이너에 필요합니다.
        InitializeComponent()

        ' AddHandler TextBox1.TextChanged, ADDRESS OF 
        'AddHandler TextBox1.TextChanged, AddressOf ControlChanged
        ' AddHandler Me.DoubleClick, Me.TextBox1.DoubleClick
        'AddHandler Me.TimeExpired, AddressOf timeExp



    End Sub
    Private Sub timeExp(ByVal sender As Object, ByVal stri As String)
        'MsgBox(stri)

    End Sub
    Private Sub ControlChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim A As TextBox = CType(sender, TextBox)
        If A.Text.Length <= 0 Then Exit Sub

        Select Case A.Text.Substring(0, 1)
            Case ":"
                If IsNumeric(A.Text.Substring(1)) Then
                    A.BackColor = Color.LawnGreen
                Else
                    A.BackColor = Color.Tomato
                End If
            Case "?"
                A.BackColor = Color.Gray
            Case "#"
                A.BackColor = Color.SteelBlue
            Case Else
                A.BackColor = Color.White
        End Select

    End Sub

    Private Sub UserControl1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.DoubleClick
        RaiseEvent TimeExpired(Me, "sdf")
    End Sub

    Private Sub TextBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.DoubleClick

        RaiseEvent TimeExpired(Me, "sdf")
    End Sub


    Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Enter
        Me.TextBox1.SelectAll()
    End Sub


    Private Sub TextBox2_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.Enter
        Me.TextBox2.SelectAll()
    End Sub

    Private Sub TextBox2_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.GotFocus
        Me.TextBox2.SelectAll()
        '   SendKeys.Send("{TAB}")
    End Sub

    Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged

    End Sub

    Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.GotFocus
        Me.TextBox1.SelectAll()
    End Sub

    Private Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        Me.CheckBox1.ForeColor = IIf(Me.CheckBox1.Checked, Color.Red, Color.Black)
        Me.Label1.ForeColor = IIf(Me.CheckBox1.Checked, Color.Red, Color.Black)
    End Sub
End Class
