Files
Hanjeon/Sub/MyControl(OleDb)v2/MyControlOLEDBv2/MyCheckBox.vb
2019-05-03 21:10:44 +09:00

184 lines
5.3 KiB
VB.net

Imports System.Text
Imports System.Data
Public Class MyCheckBox
Dim ColName As String
Dim Coltype As OleDbType
Dim Ditem As Boolean
Dim CheckVal As String
Dim UnCheckVal As String
Dim otherval As Boolean
Dim Prompt As String
Dim WhereState As String = vbNullString
Dim POS As Int16
Protected Var_ViewColNumber As Short
Protected Var_BaseLabel As Label
Private VAR_USERCLICK As Boolean = False '//우클릭시 비활성화되는데 그 기능의 사용여부이다.
''' <summary>
''' 우클릭시 컨트롤 비활성화 기능여부
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
<System.ComponentModel.Description("우클릭시 컨트롤 비활성화 기능의 사용여부")> _
Public Property DB_USERCLICK() As Boolean
Get
Return VAR_USERCLICK
End Get
Set(ByVal value As Boolean)
VAR_USERCLICK = value
End Set
End Property
''' <summary>
''' 이 컨트롤과 연결된 레이블을 설정/반환 합니다.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
<System.ComponentModel.Description("이 컨트롤과 연결된 문자를 나타낼 레이블을 선택합니다")> _
Public Property DB_BaseLabel() As Label
Get
Return Var_BaseLabel
End Get
Set(ByVal value As Label)
'//데이터가 들어오면 현재의 프롬프트를 갱신합니다.
Var_BaseLabel = value
Me.DB_Prompt = Prompt
End Set
End Property
''' <summary>
''' 검색블럭에 속해있을때의 검색조건
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
<System.ComponentModel.Description("검색블럭아이템일경우" & vbCrLf & "검색조건을 입력합니다. >= <= LIKE")> _
Public Property DB_WhereType() As String
Get
Return WhereState
End Get
Set(ByVal value As String)
WhereState = value
End Set
End Property
<System.ComponentModel.Description("컬럼의 제목입니다.")> _
Public Property DB_Prompt() As String
Get
Return IIf(Prompt Is vbNullString, DB_ColName, Prompt)
End Get
Set(ByVal value As String)
Prompt = value
End Set
End Property
<System.ComponentModel.Description("데이터베이스 컬럼")> _
Public Property DB_ColName() As String
Get
If ColName = "" Then
Return Me.Name
Else
Return ColName
End If
End Get
Set(ByVal value As String)
ColName = value
DB_Prompt = value
End Set
End Property
<System.ComponentModel.Description("지정된값외의 값이 입력되었을때 Check/UnCheck 선택")> _
Public Property DB_OtherValue() As Boolean
Get
Return otherval
End Get
Set(ByVal value As Boolean)
otherval = False
End Set
End Property
<System.ComponentModel.Description("선택했을때의 ")> _
Public Property DB_CheckValue() As String
Get
Return CheckVal
End Get
Set(ByVal value As String)
CheckVal = value
End Set
End Property
<System.ComponentModel.Description("비선택시 ")> _
Public Property DB_UnCheckVal() As String
Get
Return UnCheckVal
End Get
Set(ByVal value As String)
UnCheckVal = value
End Set
End Property
<System.ComponentModel.Description("현재 컨트롤 값을 Set/Return 비활성일시 NOTHING 반환")> _
Public Property Value() As String
Get
If Me.CheckState = Windows.Forms.CheckState.Indeterminate Then
Return Nothing
Else
Return IIf(Me.Checked, CheckVal, UnCheckVal)
End If
End Get
Set(ByVal value As String)
Select Case value
Case CheckVal
Me.Checked = True
Case UnCheckVal
Me.Checked = False
Case Else
Me.Checked = otherval
End Select
End Set
End Property
<System.ComponentModel.Description("데이터베이스 컬럼의 타입")> _
Public Property DB_Type() As OleDbType
Get
Return Coltype
End Get
Set(ByVal value As OleDbType)
Coltype = value
End Set
End Property
<System.ComponentModel.Description(" 아이템이 데이터베이스 컬럼인가?")> _
Public Property DB_ITEM() As Boolean
Get
Return Ditem
End Get
Set(ByVal value As Boolean)
Ditem = value
End Set
End Property
Private Sub CheckBox_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
If e.KeyCode = Keys.Enter Then SendKeys.Send("{TAB}")
If Me.VAR_USERCLICK AndAlso e.KeyCode = Keys.Escape Then '//우측버튼 클릭시 비활성화한다
Me.CheckState = Windows.Forms.CheckState.Indeterminate
End If
End Sub
Private Sub CheckBox_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
If Me.VAR_USERCLICK AndAlso e.Button = Windows.Forms.MouseButtons.Right Then '//우측버튼 클릭시 비활성화한다
Me.CheckState = Windows.Forms.CheckState.Indeterminate
End If
End Sub
End Class