Hi,
I'm using the MFC ribbon template to create a SDI application.
I add a new class(Cchildview) which is inherit from CWnd to mainframe.cpp.
in my mainframe.h
CChildView m_wndView
if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
{
TRACE0("Failed to create view window\n");
return -1;
}
in my childview.cpp, it will load the img and display in onpaint function as below.
void CChildView::OnPaint()
{
CString szFilename("baseimg.bmp");
HBITMAP hBmp = (HBITMAP)::LoadImage(NULL, szFilename,
IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION);
CBitmap bmp;
bmp.Attach(hBmp);
CClientDC dc(this);
CDC bmDC;
bmDC.CreateCompatibleDC(&dc);
CBitmap *pOldbmp = bmDC.SelectObject(&bmp);
BITMAP bi;
bmp.GetBitmap(&bi);
dc.BitBlt(0, 0, bi.bmWidth, bi.bmHeight, &bmDC, 0, 0, SRCCOPY);
bmDC.SelectObject(pOldbmp);
}
My image is able to show at screen. But when I adjust the separator boarder, My image is disappear, and if i readjust again, it able to display, then if i adjust again, it will show again @@.
Any idea why will this happen?
What I have tried:
use other method to load the image. result still same.