Click here to Skip to main content
15,914,074 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: u (key)is typed into edit box ? Pin
Christian Graus20-Oct-02 17:44
protectorChristian Graus20-Oct-02 17:44 
GeneralRe: u (key)is typed into edit box ? Pin
imran_rafique21-Oct-02 14:28
imran_rafique21-Oct-02 14:28 
Generaldialog bar - tab order Pin
User 988520-Oct-02 12:59
User 988520-Oct-02 12:59 
GeneralRe: dialog bar - tab order Pin
Tomasz Sowinski21-Oct-02 0:23
Tomasz Sowinski21-Oct-02 0:23 
GeneralCPropertySheet Pin
Max Santos20-Oct-02 12:27
Max Santos20-Oct-02 12:27 
GeneralRe: CPropertySheet Pin
Tomasz Sowinski21-Oct-02 0:24
Tomasz Sowinski21-Oct-02 0:24 
GeneralRe: CPropertySheet Pin
Max Santos23-Oct-02 13:51
Max Santos23-Oct-02 13:51 
QuestionDouble Buffering in a Dialog?? Pin
David_Jenkins20-Oct-02 12:06
David_Jenkins20-Oct-02 12:06 
I've spent most of today trying to get double buffering working in a dialog box.
I know the theory behind it, create an area in memory - draw to that then copy that to the display....
I've tried using other peoples code which all seems to be aimed at the OnDraw() handler with its CDC object, but in OnPaint() you've got to create your own CDC.

This is the core of the code from my OnPaint handler, there's an OnTimer event that Invalidates() the display very quickly so it's flickering like mad.
AFAIKTell it's right, I create a compatible CDC, assign a bitmap to it, draw on that then BitBlt it to the main CPaintDC.

Can anyone please help me out, I'm nearly in tears here. :-/

// Get the size of the client rectangle.
CRect cr;
GetClientRect(&cr);
int m_nDisplayWidth = cr.Width();
int m_nDisplayHeight = cr.Height();

CPaintDC dc(this); // device context for painting

CBitmap bmp, *poldbmp;
CDC memdc;

int bitplanes = dc.GetDeviceCaps(PLANES);
int bitspixel = dc.GetDeviceCaps(BITSPIXEL);

bmp.CreateBitmap(m_nDisplayWidth, m_nDisplayHeight, bitplanes, bitspixel, NULL);

memdc.CreateCompatibleDC( &dc );
poldbmp = memdc.SelectObject( &bmp);

COLORREF col;
int sp;
CPoint s;
for(int i = 0; i < m_nNumStars; i++){
sp = 255;
col = RGB(sp,sp,sp);
s.x = rand() % m_nDisplayWidth;
s.y = rand() % m_nDisplayHeight;
memdc.SetPixel(s, col );
}
dc.BitBlt(0,0, m_nDisplayWidth, m_nDisplayHeight, &memdc, 0,0, SRCCOPY);
memdc.SelectObject(poldbmp);
AnswerRe: Double Buffering in a Dialog?? Pin
Chris Losinger20-Oct-02 12:11
professionalChris Losinger20-Oct-02 12:11 
AnswerRe: Double Buffering in a Dialog?? Pin
alex.barylski20-Oct-02 12:14
alex.barylski20-Oct-02 12:14 
AnswerRe: Double Buffering in a Dialog?? Pin
Paul M Watt20-Oct-02 18:04
mentorPaul M Watt20-Oct-02 18:04 
GeneralRe: Double Buffering in a Dialog?? Pin
David_Jenkins21-Oct-02 2:12
David_Jenkins21-Oct-02 2:12 
GeneralRe: Double Buffering in a Dialog?? Pin
Paul M Watt21-Oct-02 4:18
mentorPaul M Watt21-Oct-02 4:18 
GeneralRe: Double Buffering in a Dialog?? Pin
David_Jenkins22-Oct-02 4:42
David_Jenkins22-Oct-02 4:42 
Generalstructure access from another view.. Pin
Anonymous20-Oct-02 11:07
Anonymous20-Oct-02 11:07 
GeneralRe: structure access from another view.. Pin
Joaquín M López Muñoz20-Oct-02 11:11
Joaquín M López Muñoz20-Oct-02 11:11 
GeneralRe: structure access from another view.. Pin
Anonymous20-Oct-02 11:29
Anonymous20-Oct-02 11:29 
GeneralRe: structure access from another view.. Pin
Joaquín M López Muñoz20-Oct-02 11:33
Joaquín M López Muñoz20-Oct-02 11:33 
GeneralRe: structure access from another view.. Pin
Anonymous20-Oct-02 11:41
Anonymous20-Oct-02 11:41 
GeneralOne last question Pin
Anonymous20-Oct-02 13:47
Anonymous20-Oct-02 13:47 
GeneralThreading & CStringArray - long post warning Pin
carrie20-Oct-02 10:05
carrie20-Oct-02 10:05 
GeneralRe: Threading & CStringArray - long post warning Pin
Joaquín M López Muñoz20-Oct-02 10:43
Joaquín M López Muñoz20-Oct-02 10:43 
GeneralRe: Threading & CStringArray - long post warning Pin
carrie20-Oct-02 11:02
carrie20-Oct-02 11:02 
GeneralRe: Threading & CStringArray - long post warning Pin
carrie20-Oct-02 13:41
carrie20-Oct-02 13:41 
QuestionMultiline listview?!?!!?!? Pin
Nasty_p20-Oct-02 7:49
Nasty_p20-Oct-02 7:49 

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.