gav061697
asked on
Painting onto a FormView
I have this code in the OnPaint function of my FormView:
void CMyFormView::OnPaint()
{
CPaintDC dc(this); // device context for painting
CDC dc1;
dc1.CreateCompatibleDC( &dc );
dc1.TextOut(0,138, player1_name);
}
What I want to know is from this, how to I transfer the dc1 image to the dc?
I'm doing this as I paint graphics directly onto the form and they flash when they're updated so I believe that painting everything to dc1 first then transfering it to the dc I will eliminate the flicker.
Is this the right way to do it?
void CMyFormView::OnPaint()
{
CPaintDC dc(this); // device context for painting
CDC dc1;
dc1.CreateCompatibleDC( &dc );
dc1.TextOut(0,138, player1_name);
}
What I want to know is from this, how to I transfer the dc1 image to the dc?
I'm doing this as I paint graphics directly onto the form and they flash when they're updated so I believe that painting everything to dc1 first then transfering it to the dc I will eliminate the flicker.
Is this the right way to do it?
ASKER
Just displaying text is fine...in the program I'm writing, I display bitmaps on the FormView aswell...and sometimes only some of them need redrawing...when I do this I repaint each bitmap separately which causes a flicker.
I think if you create a static control on the form and simply paint onto this static control either directly from the formview or either derive your class CMyStatic for this static control and then make a painting and redrawing call for the class. You should be able to only paint this control and not bother painting other controls.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
TextOut(hDC, 0, 138, palyer1_name);