TEXTBOX 用户控件,无法响应回车,大家帮我看下
Option Explicit
Private Sub UserControl_Initialize()
UserControl.BackColor = 0
UserControl.ScaleMode = vbPixels
Text1.BorderStyle = 0
End Sub
Private Sub UserControl_Resize()
Text1.Move 1, 1, UserControl.ScaleWidth - 2, UserControl.ScaleHeight - 2
End Sub
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Text1.Text = PropBag.ReadProperty("Text")
UserControl.BackColor = PropBag.ReadProperty("BorderColor")
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
Call PropBag.WriteProperty("Text", Text1.Text)
Call PropBag.WriteProperty("BorderColor", UserControl.BackColor)
End Sub
Public Property Get Text() As String
Text = Text1.Text
End Property
Public Property Let Text(ByVal New_Value As String)
Text1.Text = New_Value
UserControl.PropertyChanged "Text"
End Property
Public Property Get BorderColor() As OLE_COLOR
BorderColor = UserControl.BackColor
End Property
Public Property Let BorderColor(ByVal New_Value As OLE_COLOR)
UserControl.BackColor = New_Value
UserControl.PropertyChanged "BorderColor"
End Property
这上面是我自定义的用户控件
Private Sub text1_KeyPress(KeyAscii As Integer)
MsgBox "这里捕捉不到"
End Sub
为什么KeyPress这个属性在这就失效了呢?是不是在用户控件里还需要加入什么代码?
[解决办法]
其它键能捕获吗?
[解决办法]