📄 pinusercontrol.vb
字号:
Public Class PinUserControl
Private Sub btnBack_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnBack.Click
If (Me.txtPin.Text.Length > 0) Then
Me.txtPin.Text = Me.txtPin.Text.Substring(0, (Me.txtPin.Text.Length - 1))
End If
End Sub
Private Sub btn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn9.Click, btn8.Click, btn7.Click, btn6.Click, btn5.Click, btn4.Click, btn3.Click, btn2.Click, btn1.Click, btn0.Click
Dim b As Button = DirectCast(sender, Button)
If Not Me.IsEntered Then
Me.txtPin.Text = (Me.txtPin.Text & b.Text)
End If
End Sub
Public ReadOnly Property IsEntered() As Boolean
Get
Return (Me.txtPin.Text.Length = 4)
End Get
End Property
Public Overrides Property [Text]() As String
Get
Return Me.txtPin.Text
End Get
Set(ByVal value As String)
End Set
End Property
Public Event PinChanged As EventHandler
Protected Overridable Sub OnPinChanged(ByVal sender As Object, ByVal e As EventArgs)
RaiseEvent PinChanged(sender, e)
End Sub
Private Sub txtPin_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles txtPin.TextChanged
Me.OnPinChanged(sender, EventArgs.Empty)
End Sub
Private m_buttonColor As Color
Public Property ButtonColor() As Color
Get
Return m_buttonColor
End Get
Set(ByVal value As Color)
m_buttonColor = value
Me.btn0.BackColor = m_buttonColor
Me.btn1.BackColor = m_buttonColor
Me.btn2.BackColor = m_buttonColor
Me.btn3.BackColor = m_buttonColor
Me.btn4.BackColor = m_buttonColor
Me.btn5.BackColor = m_buttonColor
Me.btn6.BackColor = m_buttonColor
Me.btn7.BackColor = m_buttonColor
Me.btn8.BackColor = m_buttonColor
Me.btn9.BackColor = m_buttonColor
Me.btnBack.BackColor = m_buttonColor
End Set
End Property
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -