据我所知,不用keydown 或 change很难实现

解决方案 »

  1.   

    数字好说,控制keypress事件,这个+,-号是不是要看看win32 api?:
    Private Sub Test1_KeyPress(KeyAscii As Integer)
        If numpressvsdot(KeyAscii) = False Then
            KeyAscii = 0
        End If
    end subPublic Function numpress(ByVal m_Keycode As Integer) As Boolean
        Dim m_key As Boolean
        m_key = (m_Keycode = 8 Or m_Keycode = 13 Or _
            (m_Keycode > 47 And m_Keycode < 58))
        If (m_key = True) Then
            numpress = True
        End If
    End Function
      

  2.   

    在KEYPRESS事件中写
    Select Case KeyAscii
           Case Is < 32     ' control key
           Case 48 To 57    'number key
           CASE 45,43        '+,-
           Case Else
                KeyAscii= 0
    End Select
      

  3.   

    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Const GWL_STYLE = (-16)
    Const ES_NUMBER = &H2000&Public Sub SetNumber(NumberText As TextBox, Optional Flag As Boolean = True)
        Dim curstyle As Long, newstyle As Long    'retrieve the window style
        curstyle = GetWindowLong(NumberText.hwnd, GWL_STYLE)    If Flag Then
          curstyle = curstyle Or ES_NUMBER
        Else
          curstyle = curstyle And (Not ES_NUMBER)
        End If    'Set the new style
        newstyle = SetWindowLong(NumberText.hwnd, GWL_STYLE, curstyle)
        'refresh
        NumberText.Refresh
    End Sub
    把上面的写入一个模块中,在程序中使用: SetNumber text1  这样就可以达到你要的拉,使用 SetNumber text1  FASLE 就可以解除拉。 
      

  4.   

    Option ExplicitDeclare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
    Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
    Public Const WH_KEYBOARD = 2Global hHook As LongFunction KeyboardProc(ByVal idHook As Long, ByVal lParam As Long, ByVal wParam As Long) As Long
        KeyboardProc = 0s
    if lparam<>45 and lparam<>43 and ....相应的字符ascii码 then
    keyboardproc=1end if
    End Function
      

  5.   

    http://www.csdn.net/Expert/topic/465/465336.shtm