Click here to Skip to main content
15,893,486 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: OUT parameters in inline asm [SOLVED] Pin
csrss29-Mar-11 4:17
csrss29-Mar-11 4:17 
QuestionBit extraction from byte Pin
sathishrdh29-Mar-11 2:22
sathishrdh29-Mar-11 2:22 
AnswerRe: Bit extraction from byte Pin
Niklas L29-Mar-11 2:27
Niklas L29-Mar-11 2:27 
GeneralRe: Bit extraction from byte Pin
Albert Holguin29-Mar-11 3:50
professionalAlbert Holguin29-Mar-11 3:50 
GeneralRe: Bit extraction from byte Pin
Peter_in_278029-Mar-11 11:43
professionalPeter_in_278029-Mar-11 11:43 
GeneralRe: Bit extraction from byte Pin
Albert Holguin29-Mar-11 12:51
professionalAlbert Holguin29-Mar-11 12:51 
AnswerRe: Bit extraction from byte Pin
Stefan_Lang30-Mar-11 1:53
Stefan_Lang30-Mar-11 1:53 
QuestionFrench localization using Single-byte character set (SBCS) Pin
Selvam R28-Mar-11 23:27
professionalSelvam R28-Mar-11 23:27 
AnswerRe: French localization using Single-byte character set (SBCS) Pin
Richard MacCutchan28-Mar-11 23:59
mveRichard MacCutchan28-Mar-11 23:59 
GeneralRe: French localization using Single-byte character set (SBCS) Pin
Selvam R29-Mar-11 0:25
professionalSelvam R29-Mar-11 0:25 
GeneralRe: French localization using Single-byte character set (SBCS) Pin
Richard MacCutchan29-Mar-11 3:09
mveRichard MacCutchan29-Mar-11 3:09 
GeneralRe: French localization using Single-byte character set (SBCS) Pin
Selvam R29-Mar-11 18:48
professionalSelvam R29-Mar-11 18:48 
QuestionHow to revert SetCheckBox style ? [modified] Pin
_Flaviu28-Mar-11 21:30
_Flaviu28-Mar-11 21:30 
AnswerRe: How to revert SetCheckBox style ? Pin
Richard MacCutchan28-Mar-11 22:32
mveRichard MacCutchan28-Mar-11 22:32 
GeneralRe: How to revert SetCheckBox style ? Pin
_Flaviu29-Mar-11 5:03
_Flaviu29-Mar-11 5:03 
GeneralRe: How to revert SetCheckBox style ? Pin
Richard MacCutchan29-Mar-11 5:36
mveRichard MacCutchan29-Mar-11 5:36 
GeneralRe: How to revert SetCheckBox style ? Pin
_Flaviu29-Mar-11 20:52
_Flaviu29-Mar-11 20:52 
QuestionCapture keyboard event in a dialog dll Pin
Y K Kishore Kumar28-Mar-11 20:27
Y K Kishore Kumar28-Mar-11 20:27 
AnswerRe: Capture keyboard event in a dialog dll Pin
Selvam R29-Mar-11 1:49
professionalSelvam R29-Mar-11 1:49 
QuestionIs any way to draw Background Image? Pin
002comp28-Mar-11 19:47
002comp28-Mar-11 19:47 
AnswerRe: Is any way to draw Background Image? Pin
Nitheesh George28-Mar-11 20:30
Nitheesh George28-Mar-11 20:30 
AnswerRe: Is any way to draw Background Image? Pin
Niklas L28-Mar-11 20:57
Niklas L28-Mar-11 20:57 
AnswerRe: Is any way to draw Background Image? Pin
Hans Dietrich28-Mar-11 22:46
mentorHans Dietrich28-Mar-11 22:46 
You have three opportunities to reduce flicker:

1. Draw the image in the OnEraseBkgnd() handler and return TRUE.

2. Do other drawing in the OnPaint() handler. Use CMemDC to double buffer the dc. Since the entire background (I assume) is being covered with the image, there is no need to do a "fill" in OnPaint(); in fact, doing do would wipe out the image that was just drawn in OnEraseBkgnd().

3. In the OnSize() handler, tell Windows to defer re-positioning your controls until you are finished, You do this by using the DeferWindowPos() function (there are two other functions you will need, they are explained at that link).

The way Windows works, anything that obscures your window causes a WM_ERASEBKGND message to be sent to your window. This means that your window has to be redrawn when it is uncovered. Examples: moving another window on top of your window, or minimizing/restoring your window. So to answer your question, there is no way to "permanently" paint the background, because it is constantly being redrawn due to normal window operations.

It is also somewhat customary to do background stuff in OnEraseBkgnd() and foreground stuff in OnPaint(), although this is not a hard rule you have to follow; you can be sure that every WM_ERASEBKGND message will be followed by a WM_PAINT message.
Best wishes,
Hans


[Hans Dietrich Software]

GeneralRe: Is any way to draw Background Image? Pin
002comp29-Mar-11 2:32
002comp29-Mar-11 2:32 
QuestionError message running exe Pin
Cyclone_S28-Mar-11 13:55
Cyclone_S28-Mar-11 13:55 

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.