ListBox必须是OwnerDraw时才可以设置LBS_HASSTRINGS风格

解决方案 »

  1.   

    VC里面是这样的,不知VB是不是也这样
      

  2.   

    我发了消息设置LBS_OWNERDRAWVARIABLE
    但没有用。
      

  3.   

    错误地点有二。
    1。
    a = SetWindowPos(Me.hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOZORDER Or SWP_FRAMECHANGED)
    为LIST1。HWND
    2。必须发送相关风格
      

  4.   

    MSVCer(我他妈还不如去筛沙呢) 
    说的对,但在VB中不用。
      

  5.   

    'This project needs a TextBox
    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, Flag As Boolean)
        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
    Private Sub Form_Load()
        'KPD-Team 1999
        'URL: http://www.allapi.net/
        'E-Mail: [email protected]
        
        SetNumber Text1, True
        Me.Caption = "Now, try typing some letters into the textbox"
    End Sub