Board index » Visual Studio » retrieve the bitmap in a particular DC

retrieve the bitmap in a particular DC

Visual Studio371
Hello MFCians,

I draw a circle on CWnd object's client area. this Cwnd object is

created from Cview derived class of SDI application. My problem is that

after i minimize the view i loose my drawing . I guess i need to store

current bitmap before minimizing. but how can i do this. is there any

method to retrieve the bitmap in a particular DC?



Thanks.


-
 

Re:retrieve the bitmap in a particular DC



Arpit wrote:

Quote
Hello MFCians,

I draw a circle on CWnd object's client area. this Cwnd object is

created from Cview derived class of SDI application. My problem is that

after i minimize the view i loose my drawing . I guess i need to store

current bitmap before minimizing. but how can i do this. is there any

method to retrieve the bitmap in a particular DC?



Thanks.



Note please:- i m not using any bitmap object for drawing circle. i

directly take a CDC object and use ellipse function.

Thanks once again



-

Re:retrieve the bitmap in a particular DC

In article <1154513428.766044.47480@p79g2000cwp.googlegroups.com>,

arpitpmehta@gmail.com says...

Quote
Hello MFCians,

I draw a circle on CWnd object's client area. this Cwnd object is

created from Cview derived class of SDI application. My problem is that

after i minimize the view i loose my drawing . I guess i need to store

current bitmap before minimizing. but how can i do this. is there any

method to retrieve the bitmap in a particular DC?



The CDC/CPaintDC and associated bitmap you are painting on belong to

the CView. What you need is to create a memory CDC with its own

bitmap. Draw your image on that, and BitBlt it to the CView CDC when

you need to.



A good basic rule is always to create a memory CDC and CBitmap at the

same time and keep them together. There is no good reason for

selecting CBitmaps in and out.



- Gerry Quinn

-

Re:retrieve the bitmap in a particular DC

Thanks for helping me out, Gerry Quinn





Gerry Quinn wrote:

Quote
In article <1154513428.766044.47480@p79g2000cwp.googlegroups.com>,

arpitpmehta@gmail.com says...

>Hello MFCians,

>I draw a circle on CWnd object's client area. this Cwnd object is

>created from Cview derived class of SDI application. My problem is that

>after i minimize the view i loose my drawing . I guess i need to store

>current bitmap before minimizing. but how can i do this. is there any

>method to retrieve the bitmap in a particular DC?



The CDC/CPaintDC and associated bitmap you are painting on belong to

the CView. What you need is to create a memory CDC with its own

bitmap. Draw your image on that, and BitBlt it to the CView CDC when

you need to.



A good basic rule is always to create a memory CDC and CBitmap at the

same time and keep them together. There is no good reason for

selecting CBitmaps in and out.



- Gerry Quinn



-