Display updated bitmap

Posted on 2004-11-27
Last Modified: 2013-11-20

I am new to MFC programming. Please help!
My program use onDraw to display a bitmap to screen initially. After the user press "Convert" button, it will trigger the OnConvert function to modify the bit of this bitmap. And display again.

My problem is how to get pDC in OnConvert function.

void CMFCView::OnDraw(CDC* pDC)

pDC->StretchBlt(0, 0, iClientWidth, iClientHeight, &dcMemory, 0, 0, iBpWidth, iBpHeight, SRCCOPY);

void CMFCView::OnConvert()

Question by:smallee
    LVL 55

    Accepted Solution

    Don't need this, after converting bitmap call Invalidate(TRUE) to force repaint.
    LVL 3

    Author Comment


    but if i want to reset the iBpWidth and iBpHeight to a new value in OnConvert function

    how can i do it?
    LVL 2

    Assisted Solution

    Create a bitmap of required size and select it into the dcMemory. "Selecting an image into a dc" means, that this is a bitmap that is drawn to.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
    If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now