论坛上找了很旧,没找到!问题:
1、如何设置ComboBox的高度?
2、哪里可以找到有关API的所有常数?

解决方案 »

  1.   

    用Microsoft Forms 2.0 Object Library控件组提供的ComboBox
      

  2.   

    如果只是想探讨技术的话:
    Option ExplicitPrivate Type RECT
      Left As Long
      Top As Long
      Right As Long
      Bottom As Long
    End TypePrivate Declare Function GetWindowRect Lib "user32" _
     (ByVal hwnd As Long, lpRect As RECT) As Long
    Private Declare Function SendMessageLong Lib "user32" _
     Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
     ByVal wParam As Long, ByVal lParam As Long) As LongPublic Function ComboHeight(Combo As ComboBox, _
     ByVal Height As Single, Optional ByVal ScaleMode = -1) _
     As Single  Dim nHeight As Long
      Dim nScaleMode As Integer
      Dim nHeightDiff As Long
      Dim nRect As RECT
      Dim nOldHeight As Long
      Dim nOldComboHeight As Long
      
      Const CB_GETITEMHEIGHT = &H154
      Const CB_SETITEMHEIGHT = &H153
      
      With Combo
        GetWindowRect .hwnd, nRect
        nOldHeight = SendMessageLong(.hwnd, CB_GETITEMHEIGHT, -1, 0)
        nOldComboHeight = nRect.Bottom - nRect.Top
        nHeightDiff = nOldComboHeight - nOldHeight
        If ScaleMode = -1 Then
          On Error Resume Next
          nScaleMode = .Container.ScaleMode
          If Err.Number Then
            nScaleMode = vbTwips
          End If
          On Error GoTo 0
        Else
          nScaleMode = ScaleMode
        End If
        On Error Resume Next
        nHeight = .Parent.ScaleY(Height, nScaleMode, vbPixels)
        If Err.Number Then
          If ScaleMode = vbPixels Then
            nHeight = Height
            ComboHeight = nOldComboHeight
          Else
            nHeight = Height \ Screen.TwipsPerPixelY
            ComboHeight = nOldComboHeight * Screen.TwipsPerPixelY
          End If
        Else
          ComboHeight = _
           .Parent.ScaleY(nOldComboHeight, vbPixels, nScaleMode)
        End If
        On Error GoTo 0
        SendMessageLong .hwnd, CB_SETITEMHEIGHT, -1, _
         nHeight - nHeightDiff
      End With
    End Function'调用
    Private Sub Command1_Click()
        ComboHeight Me.Combo1, 400
    End Sub
    //哪里可以找到有关API的所有常数
    印象中好象没有这样的地方,如果你找到了,记得告诉我:) api浏览器中,有大部分常用常数的声明
      

  3.   

    msdn上有api常数的声明。全部?哪有?
      

  4.   

    有关Combo的阐述,rainstormmaster正确!api常数的声明,真是没人能找到吗?