Click here to Skip to main content
15,891,629 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Need help with ported c++ triangulation routine Pin
Steve Echols25-Jul-06 20:35
Steve Echols25-Jul-06 20:35 
GeneralRe: Need help with ported c++ triangulation routine Pin
spacecadet1029-Jul-06 16:54
spacecadet1029-Jul-06 16:54 
Questionmfc drawing philosophy question - when is the correct time to draw? Pin
charlieg25-Jul-06 14:10
charlieg25-Jul-06 14:10 
AnswerRe: mfc drawing philosophy question - when is the correct time to draw? Pin
User 58385225-Jul-06 15:09
User 58385225-Jul-06 15:09 
AnswerRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Michael Dunn25-Jul-06 16:10
sitebuilderMichael Dunn25-Jul-06 16:10 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
charlieg25-Jul-06 16:45
charlieg25-Jul-06 16:45 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Justin Tay25-Jul-06 20:43
Justin Tay25-Jul-06 20:43 
AnswerRe: mfc drawing philosophy question - when is the correct time to draw? [modified] Pin
charlieg26-Jul-06 1:13
charlieg26-Jul-06 1:13 
hfry,

I don't seem to be communicating clearly - sleep deprevation most likely. I understand your test case. As I move windows, paint events should arrive. I understand this. What I'm trying to get a handle on is the dialog creation / paint notification sequence of events. Why such a restrictive situation you ask? The answer lies in my target application - it is a touchscreen and all window navigation is under program control.

In my specific situation, I create my dialog and initiate periodic updates to the screen. 99% of the time, this works like a charm. I happen to be in the 1% zone, and the window just won't paint correctly. I've reduced my code to attempting to blit a single, red-filled bitmap. The code is below. What I see on the dialog is WHITE when the red should be. If I change the FillRect call to go directly to the dialog DC, it draws correctly.


In my dialog, I do this:

OnPaint()
{
//CPaintDC dc(this); // don't need this, let drawing class deal with it.
UpdateDisplayData(); // Render the graphics.
}

....

In the drawing code (no, the class' name is not this silly...), I have culled out 99% of my code, reducing it to a single bitmap fill and blt:

CDisplayData::UpdateDisplayData()
{
CPaintDC dcDialog(m_pParentWindow);
CDC dcBitmap;

BOOL bStatus = dcBitmap.CreateCompatibleDC(&dcDialog);
ASSERT (bStatus);

CBitmap buffer_bm;
CBitmap *old_bm;

// Create an offscreen bitmap for antiflicker buffering...
bStatus = buffer_bm.CreateCompatibleBitmap(&dcBitmap, 100, 100);
ASSERT (bStatus);
old_bm = dcBitmap.SelectObject(&buffer_bm);

// Fill the bitmap with an arbitrary color, and copy it to the screen.
// "RED" is a macro...

dcBitmap.FillSolidRect(0, 0, 500, 100, RED);

bStatus = dcDialog.BitBlt(rc.left,
rc.top,
rc.Width(),
rc.Height(),
&dcBitmap, 0, 0, SRCCOPY);

dcBitmap.SelectObject(old_bm);
}



-- modified at 7:17 Wednesday 26th July, 2006


GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Justin Tay26-Jul-06 2:22
Justin Tay26-Jul-06 2:22 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
charlieg26-Jul-06 3:39
charlieg26-Jul-06 3:39 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
charlieg26-Jul-06 4:02
charlieg26-Jul-06 4:02 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Justin Tay26-Jul-06 4:19
Justin Tay26-Jul-06 4:19 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
charlieg26-Jul-06 4:24
charlieg26-Jul-06 4:24 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Justin Tay26-Jul-06 4:13
Justin Tay26-Jul-06 4:13 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
charlieg26-Jul-06 4:59
charlieg26-Jul-06 4:59 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Justin Tay26-Jul-06 5:34
Justin Tay26-Jul-06 5:34 
QuestionConvert CString to Unsigned short & Vice Versa Pin
JBAK_CP25-Jul-06 13:00
JBAK_CP25-Jul-06 13:00 
AnswerRe: Convert CString to Unsigned short &Vice Versa Pin
Justin Tay25-Jul-06 13:15
Justin Tay25-Jul-06 13:15 
QuestionBitmap associated with a static control Pin
cphawk25-Jul-06 12:09
cphawk25-Jul-06 12:09 
AnswerRe: Bitmap associated with a static control Pin
sudeesh26-Jul-06 2:40
sudeesh26-Jul-06 2:40 
QuestionCan't find files Pin
jimNLX25-Jul-06 11:52
jimNLX25-Jul-06 11:52 
AnswerRe: Can't find files Pin
Justin Tay25-Jul-06 13:22
Justin Tay25-Jul-06 13:22 
QuestionTabCtrlSSL tab control code Pin
BuckBrown25-Jul-06 10:18
BuckBrown25-Jul-06 10:18 
QuestionPrecompiled header error Pin
Jay0325-Jul-06 8:41
Jay0325-Jul-06 8:41 
AnswerRe: Precompiled header error Pin
Zac Howland25-Jul-06 8:53
Zac Howland25-Jul-06 8:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.