CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Aug 2011
    Posts
    21

    Question show a bitmap in MFC

    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:
    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 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,
    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);
    Last edited by Angela2010; November 5th, 2011 at 08:39 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured