Visual C++ beginner
Posted on 1998-06-20
I am learning Ms Visual C++
I have the following problem
Theo following example is regarding loading and displaying a bitmap.
void CBitmapView::OnDraw(CDC* pDC)
CBitmap* pbmpOld = dcMem.SelectObject(&bmpHello);
I think I understand most of it.
Still I do not get exactly the use of SelectObject function.
I read about it in the MFC, and it says that the "
CPen* SelectObject( CPen* pPen );
SelectObject function returns a pointer to the object being replaced....For example, if pObject of the general version of SelectObject points to a CPen object, the function replaces the current pen with the pen specified by pObject.
I am confused.
What is the current pen ?(or bitmap). Is there any special meaning for such a "current pen", or current bitmap ?
In my example.
I understand that the first time, I declare a pointer to a CBitmap class, this pointer is pbmpOld.
By assigning to pbmpOld the value returned by the dcMem.SelectOjbect(&bmpHello) function, I make the pbmOlod pointer to point to the bmpHello object wich is an object of CBitmap class.
after that, I use the BitBlt function to copy the content of the pbmpOld pointed object(or I could say the content of the bmpHello object), from the DC to the deviced specified by the pDC pointer.
Untill here I did not make any use of the pbmpOld.
Here I use
I do not understand the meaning of using this function.
The explination in the book is, " Reselect the original bitmap into the memory DC.".
Hope someone can help.