Re: add background image to SDI Application
Hi Ajay,
I'm not using document and view architecture support in my SDI.
however, i follow the code in
http://www.codeguru.com/cpp/w-d/doc_view/sdi/article.php/c6099/
to just change bg color, by placing in my MainFrm
but when I launch the program, still no color show.
when I trying to resize the SDI framework windows using mouse to drag,
then I can see
the color on and off, on and off.
BOOL CMainFrame::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
CBrush brNew(RGB(0,0,255)); //Creates a blue brush
CBrush* pOldBrush = (CBrush*)pDC->SelectObject(&brNew);
CRect rc;
pDC->GetClipBox(rc); // Gets the co-ordinates of the client
// area to repaint.
pDC->PatBlt(0,0,rc.Width(),rc.Height(),PATCOPY);
// Repaints client area with current brush.
pDC->SelectObject(pOldBrush);
return TRUE; // Prevents the execution of return
// CView::OnEraseBkgnd(pDC) statement
return CFrameWnd::OnEraseBkgnd(pDC);
}
On Dec 4, 11:27 pm, Ajay Kalra <ajayka...@yahoo.com> wrote:
On Dec 4, 10:02 am, "aloha...@gmail.com" <aloha...@gmail.com> wrote:
Hi,
Can someone tell me what is the easiest way to add the background
image to SDI application ?
a sample project will be great.
Regards,
Kenji
Override OnEraseBkgnd of your view. Following shows how to change the
color but you can put the image there as well:
http://www.codeguru.com/cpp/w-d/doc_view/sdi/article.php/c6099/
--
Ajay