graber
asked on
difference between CDC & CPaintDC
The following are snips use either the CDC or CPaintDC to draw a bitmap to the screen. The first example doen't do what I would have expected.
void CBunchesObuttonsDlg::OnPai nt()
{
CPaintDC dc(this);
CDC cdc;
cdc.CreateCompatibleDC(&dc );
m_ilButtonStateList.Draw(& cdc, 0,CPoint(50,50), ILD_SELECTED);
CDialog::OnPaint();
}
However if I use the CPaintDC it works fine. Why? what is the difference between CDC and CPaintDC. What would I have to do to make the CDC work? Please expand/expound.
void CBunchesObuttonsDlg::OnPai nt()
{
CPaintDC dc(this);
CDC cdc;
cdc.CreateCompatibleDC(&dc );
m_ilButtonStateList.Draw(& dc, 0,CPoint(50,50), ILD_SELECTED);
CDialog::OnPaint();
}
void CBunchesObuttonsDlg::OnPai
{
CPaintDC dc(this);
CDC cdc;
cdc.CreateCompatibleDC(&dc
m_ilButtonStateList.Draw(&
CDialog::OnPaint();
}
However if I use the CPaintDC it works fine. Why? what is the difference between CDC and CPaintDC. What would I have to do to make the CDC work? Please expand/expound.
void CBunchesObuttonsDlg::OnPai
{
CPaintDC dc(this);
CDC cdc;
cdc.CreateCompatibleDC(&dc
m_ilButtonStateList.Draw(&
CDialog::OnPaint();
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In OnPaint, you are responsible for drawing the whole client area of the window. A memory DC is like a buffer. You may draw onto a memory DC and finally copy it to the screen DC by using BitBlt. For more information, see http://members.tripod.com/digitaldawn/section11/section11.html
ASKER