Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

transparent background for listbox

24 views
Skip to first unread message

the_dent...@my-deja.com

unread,
Aug 31, 1999, 3:00:00 AM8/31/99
to
hi all,
how can i make the listbox white background transparent, so that e.g.
the background (bitmap or something else) of the underlaying dialog is
visible. a example code would be nice...

thx


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Johan Rosengren

unread,
Sep 3, 1999, 3:00:00 AM9/3/99
to
Create a class derived from CListBox. Make the listbox owner drawn.
Map the messages WM_PAINT and WM_ERASEBKGND. Create an override for
DrawItem.

Write - in the new listbox class:

BOOL CMyListBox::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
}
void CMyListBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
pDC->SetBkMode(TRANSPARENT);
// Add your own drawing of each line here
}
void CMyListBox::OnPaint()
{
CPaintDC dc(this); // device context for painting

dc.SetBkMode(TRANSPARENT);
}

Create a control variable for your listbox, using this class instead of the
normal CListBox.

As you can see, some more coding is necessary (the drawing of the individual
lines in the listbox. Happy drilling!

Johan Rosengren
Responsable Informatique
PACTA S.A.

<the_dent...@my-deja.com> a écrit dans le message :
7qg2d2$6do$1...@nnrp1.deja.com...

0 new messages