Add this declaration to the CMultiColumnItem class:
Code: Select all
Private Declare Function CreateSolidBrush Lib "gdi32.dll" (ByVal crColor As Long) As Long
Add this variable to the CMultiColumnItem.OwnerDrawItem method:
In this method replace the following code
Code: Select all
If itemState And OwnerDrawItemStateConstants.odisSelected Then
If itemState And OwnerDrawItemStateConstants.odisFocus Then
newBkColor = COLOR_HIGHLIGHT
newLineColor = COLOR_3DSHADOW
newTextColor = COLOR_HIGHLIGHTTEXT
Else
newBkColor = COLOR_3DFACE
newLineColor = COLOR_3DSHADOW
newTextColor = COLOR_BTNTEXT
End If
Else
newBkColor = COLOR_WINDOW
newLineColor = COLOR_3DSHADOW
newTextColor = COLOR_WINDOWTEXT
End If
' draw item background
Call FillRect(hDC, rcItem, GetSysColorBrush(newBkColor))
' draw the columns
hPen = CreatePen(PS_SOLID, 1, GetSysColor(newLineColor))
If hPen Then
hPreviousPen = SelectObject(hDC, hPen)
oldTextColor = SetTextColor(hDC, GetSysColor(newTextColor))
with
Code: Select all
If itemState And OwnerDrawItemStateConstants.odisSelected Then
If itemState And OwnerDrawItemStateConstants.odisFocus Then
newBkColor = GetSysColor(COLOR_HIGHLIGHT)
newLineColor = GetSysColor(COLOR_3DSHADOW)
newTextColor = GetSysColor(COLOR_HIGHLIGHTTEXT)
Else
newBkColor = GetSysColor(COLOR_3DFACE)
newLineColor = GetSysColor(COLOR_3DSHADOW)
newTextColor = GetSysColor(COLOR_BTNTEXT)
End If
Else
newBkColor = vbBlack 'GetSysColor(COLOR_WINDOW)
newLineColor = GetSysColor(COLOR_3DSHADOW)
newTextColor = vbWhite 'GetSysColor(COLOR_WINDOWTEXT)
End If
' draw item background
hBrush = CreateSolidBrush(newBkColor)
Call FillRect(hDC, rcItem, hBrush)
Call DeleteObject(hBrush)
' draw the columns
hPen = CreatePen(PS_SOLID, 1, newLineColor)
If hPen Then
hPreviousPen = SelectObject(hDC, hPen)
oldTextColor = SetTextColor(hDC, newTextColor)
Regards
TiKu