VB6SP6, VBCCR17, Win10 (latest)
I subclassed a ImageCombo from Krool's Common Controls Replacement to change the background color and text color of the DropDownList.
Unfortunately, the APIs don't affect the background color and text color.
Can someone check my subclass code?
Code:Public Declare Function SetTextColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long Public Declare Function SetBkColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long Private Declare Function SetBkMode Lib "gdi32" (ByVal hdc As Long, ByVal nBkMode As Long) As Long Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long Const OPAQUE = 2 Const TRANSPARENT = 1 Dim hBrush As Long Private Function ISubclass_WindowProc(ByVal hWnd As Long, ByVal iMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long If hWnd = ImageCombo1.hWnd Then If iMsg = WM_CTLCOLORLISTBOX Then 'https://learn.microsoft.com/en-us/windows/win32/controls/wm-ctlcolorlistbox ' wParam = Handle to the device context for the list box. ' lParam = Handle to the list box. If lParam = ImageCombo1.hWndList Then SetBkMode wParam, OPAQUE SetBkColor wParam, vbBlack SetTextColor wParam, vbWhite hBrush = CreateSolidBrush(vbBlack) 'list background color ISubclass_WindowProc = hBrush ' return background color End If End If End If End Function Leider haben die APIs keine Auswirkungen auf den Hintergrund und Textfarbe.


Reply With Quote
