请问关于setpixel()画图?
我想用setpixel画图,我的程序编译通过,在执行时点击菜单但是却没有图画出来,为什么?下面是我得程序。
void CGxlView::OnMarking()
{
// TODO: Add your command handler code here
CWnd *pWnd=GetDlgItem(IDC_PICTURE_DISPLAY);//得到控件窗口的指针
CDC *pDC = pWnd->GetDC();
pWnd->Invalidate();
pWnd->UpdateWindow();
CGxlDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
HDIB hDIB = pDoc->GetHDIB();
if (hDIB != NULL)
{
LPSTR lpDIB = (LPSTR) ::GlobalLock((HGLOBAL) hDIB);
int Width=(int)::DIBWidth(lpDIB);
int Height=(int)::DIBHeight(lpDIB);
for(int i=1;i<Height;i++)
{
for(int j=1;i<Width;j++)
{
pDC->SetPixel(i,j,RGB(255,0,0));
}
}
}
pWnd->ReleaseDC(pDC);
}