What is difference between OnPaint and OnDraw?
-
Hi, I am developing a application in which I need to draw the some text and graphics on the view. I can do this in OnPaint as well as in OnDraw. But when one should use OnPaing and when OnDraw()? What is difference between OnPaint and OnDraw? Regards, Hemant Kulkarni.
-
Hi, I am developing a application in which I need to draw the some text and graphics on the view. I can do this in OnPaint as well as in OnDraw. But when one should use OnPaing and when OnDraw()? What is difference between OnPaint and OnDraw? Regards, Hemant Kulkarni.
OnDraw()
is ultimately called byOnPaint()
, as you can find inside MFC sources:void CView::OnPaint()
{
// standard paint routine
CPaintDC dc(this);
OnPrepareDC(&dc);
OnDraw(&dc);
}There you can also see what happens inside
OnPrepare()
. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
Hi, I am developing a application in which I need to draw the some text and graphics on the view. I can do this in OnPaint as well as in OnDraw. But when one should use OnPaing and when OnDraw()? What is difference between OnPaint and OnDraw? Regards, Hemant Kulkarni.
-
Hi, I am developing a application in which I need to draw the some text and graphics on the view. I can do this in OnPaint as well as in OnDraw. But when one should use OnPaing and when OnDraw()? What is difference between OnPaint and OnDraw? Regards, Hemant Kulkarni.
Hemant kulkarni wrote:
What is difference between OnPaint and OnDraw?
OnPaint()
belongs toCWnd
and handles theWM_PAINT
message, whileOnDraw()
belongs toCView
and is virtual.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb