Yevgen
asked on
Temp DC
I have a program with SDI document and i'm drawing all kinds of things on the client area. What i did was to call Draw functions of all object that should be drawn from the View class Draw function.
My problem is that it draws everything slowly. What i tried was to create a temp CDC object and send it to the draw functions and when it returns copy it to the active DC. I tried using BitBlt but it doesnt work. How can i do this?
My problem is that it draws everything slowly. What i tried was to create a temp CDC object and send it to the draw functions and when it returns copy it to the active DC. I tried using BitBlt but it doesnt work. How can i do this?
ASKER
Can you show me how to do this. I need the temp DC to be the same size as the main DC.
Tnx...
Tnx...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That works but the bitmap is monochrome and the background is black. Can you help me with this one?
Whoops.
Change the &dcMem in the CreateCompatibleBitmap to &paintDC.
Like I said, the default bitmap is monochrome.
Change the &dcMem in the CreateCompatibleBitmap to &paintDC.
Like I said, the default bitmap is monochrome.
ASKER
Tnx, one last thing... The pixels which i dont use are filled with random colors, can i somehow clean them?
Before drawing do a PatBlt with WHITENESS, or, to be more compatible, do a FillRect with a brush the color of the window:
CBrush brBackground(::GetSysColor (COLOR_WIN DOW));
dcMem.FillRect(rcClient, brBackground); // rcClient always has (0, 0) as upper left.
Oh, and since you don't need it, override OnEraseBkgnd and just return TRUE so the system doesn't bother filling the window for you.
CBrush brBackground(::GetSysColor
dcMem.FillRect(rcClient, brBackground); // rcClient always has (0, 0) as upper left.
Oh, and since you don't need it, override OnEraseBkgnd and just return TRUE so the system doesn't bother filling the window for you.
If that isn't the problem you really will need to provide a code sample or more details.