Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Custom ComboBox Class (Just to change height)

$
0
0

Hi,

I just want to make my own custom ComboBox to change its height, so here's my code but I just can't make it work, any help would be appreciated, thanks in advance.

Public Class DxCombo
    Inherits System.Windows.Forms.ComboBox

    Private _DxHeight As Int16 = 12
    Public Property DxHeight() As Int16
        Get
            Return _DxHeight
        End Get
        Set(ByVal value As Int16)
            _DxHeight = value
        End Set
    End Property

    Public Sub New()

        DrawMode = DrawMode.OwnerDrawFixed
        FlatStyle = Windows.Forms.FlatStyle.Flat
        SetComboEditHeight(Me, DxHeight)

    End Sub

    Private Declare Auto Function SendMessage Lib "user32.dll" ( _
        ByVal hwnd As IntPtr, _
        ByVal wMsg As Int32, _
        ByVal wParam As Int32, _
        ByVal lParam As Int32) As Int32
    Private Const CB_ERR As Int32 = -1
    Private Const CB_SETITEMHEIGHT As Int32 = &H153

    Private Sub SetComboEditHeight(ByVal Control As ComboBox, ByVal NewHeight As Int32)
        SendMessage(Control.Handle, CB_SETITEMHEIGHT, -1, NewHeight)
        Control.Refresh()
    End Sub

End Class


G.Waters


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>