Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

avoid Erase of Custom Draw

Status
Not open for further replies.

6142

Programmer
Oct 18, 2000
18
CA
Hi Everybody !

I have a tree control and I catch Custom Draw messages.

LRESULT CTreeListBox::OnCustomDraw(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
{

switch (pCustomDraw->nmcd.dwDrawStage)
{
case CDDS_PREPAINT:
CDC dc;
dc.Attach(pCustomDraw->nmcd.hdc);
dc.FillRect(&rcClient,&backcolor_brush);
return CDRF_NOTIFYITEMDRAW;

case CDDS_ITEMPREPAINT:
return CDRF_SKIPDEFAULT;
}

return 0;
}

I'm doing FillRect and paiting the whole client area when I get the Prepaint notification.
But I have a problem.
It seems like the Client area is erased on each cycle of Custom Draw messages.
(and then painted again with the FillRect call).

My questions is:
How can I get the CDDS_PREERASE notification ?
and more important
How can I avoid the erase cycle every times I refresh the Tree Control ,
so that i wouldnt have to fillrect again and again ?
I want to avoid the erasing of the backcolor of my control.

Thanks for any help.
Ron

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top