Hi all,
I use a dialog in MFC to load and show a bmp successfully, I use a picture control , now I want to mark part of the bmp with red color with the following code:
the red part disappeared at once as the bmp was loaded, I just can not make the bmp and the red part I marked show at the same time, can anyone help me with this ,thank you very much,Code:CWnd *pWnd=GetDlgItem(IDC_STATIC1); CRect rect; pWnd->GetClientRect(&rect); CClientDC dcImage1(pWnd); COLORREF col=RGB(255,0,0); for( int i = 200; i < 300; i++) for(int j = 200; j < 300; j++) dcImage1.SetPixel(i,j,col); pWnd->InvalidateRect(&rect);
the following is part of my code to load the bmp:
Code:m_st1.GetClientRect( &rectStaticClient ); // define a variable of the picture control: CStatic m_st1 ... m_st1.ClientToScreen( &rectStaticClient ); ScreenToClient( &rectStaticClient); ... GetObject( m_hBmpNew , sizeof(BITMAP), &m_bmInfo ); ... InvalidateRect(&rectStaticClient);




Reply With Quote
