各位大虾:
     我在VC单文档里实现读位图并显示和保存,自定义一个下拉菜单,打开位图,能正常打开,自定义一个DIB类,Draw函数如下:
void CDIB::Draw(CDC* pDC)
{
DWORD width = GetWidth();
DWORD height = GetHeight(); StretchDIBits(pDC->m_hDC,0,0,width,height,0,0,width,height,m_pPixel,
(BITMAPINFO*)m_pBmInfo,DIB_RGB_COLORS,SRCCOPY);
UpdateWindow();
}
在View类OnDraw()函数内调用:
void CBitmapView::OnDraw(CDC* pDC)
{
CBitmapDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
if(pDoc->GetInstance()->read==TRUE)
{
pDoc->GetInstance()->Draw(pDC);
}
}
但是每次打开位图后,不能立即显示,必须当一个窗口覆盖单文档区域后才能显示,是不是刷新有问题,我调用了UpDateWindow()但是没用