change background color of drop down list box 
Author Message
 change background color of drop down list box

I am trying to change the background color of the display portion (not the
list box) of a drop down list box using the standard technique of
overwriting OnEraseBackground() via:

    CBrush backBrush(Color);

    // Save old brush.
    CBrush* pOldBrush = pDC->SelectObject(&backBrush);

    CRect rect;
    pDC->GetClipBox(&rect);     // Erase the area needed.
    pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY);
    pDC->SelectObject(pOldBrush);

    return TRUE;

But it paints the bacground of the dialog instead.

Any suggestions?
--



Fri, 07 Jan 2000 03:00:00 GMT  
 change background color of drop down list box

Quote:

> I am trying to change the background color of the display portion (not the
> list box) of a drop down list box using the standard technique of
> overwriting OnEraseBackground() via:

>     CBrush backBrush(Color);

>     // Save old brush.
>     CBrush* pOldBrush = pDC->SelectObject(&backBrush);

>     CRect rect;
>     pDC->GetClipBox(&rect);     // Erase the area needed.
>     pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY);
>     pDC->SelectObject(pOldBrush);

>     return TRUE;

> But it paints the bacground of the dialog instead.

> Any suggestions?
> --


Generally, to change the colors of controls, you must intercept the
WM_CTLCOLOR message in your app. There is an example of how to do this
at the URL below if you're interested.

Cecil
--
Cecil Galbraith

Free programmer's utilities and MFC tips at
http://www.concentric.net/~cgalbrai



Sat, 08 Jan 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Setting the hight of a list in a combo box (Drop Down List)

2. Setting the hight of a list in a combo box (Drop Down List)

3. Setting the hight of a list in a combo box (Drop Down List)

4. Background of a drop down combo box

5. Q: how to put a drop down in a list box dynamically

6. Expanding Drop Down List Boxes

7. tooltips and in drop-down list box, possible?

8. Can't Get Drop-Down List in Combo Box to Appear

9. Combo Box Drop down list

10. Combo box control automatically drop down the list of items

11. Resize a Drop Down List Box ?

12. Drop Down Boxes in a List View

 

 
Powered by phpBB® Forum Software