Click here to Skip to main content
16,016,345 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
JokeRe: run programme when run PC Pin
CPallini13-Jul-09 23:33
mveCPallini13-Jul-09 23:33 
GeneralRe: run programme when run PC Pin
Michael Schubert14-Jul-09 0:45
Michael Schubert14-Jul-09 0:45 
GeneralRe: run programme when run PC Pin
CPallini14-Jul-09 0:47
mveCPallini14-Jul-09 0:47 
GeneralRe: run programme when run PC Pin
Caslen14-Jul-09 2:09
Caslen14-Jul-09 2:09 
AnswerRe: run programme when run PC Pin
David Crow14-Jul-09 9:10
David Crow14-Jul-09 9:10 
QuestionTurbo C 3.0 & kernel VGA Pin
tuan111113-Jul-09 17:13
tuan111113-Jul-09 17:13 
QuestionRe: Turbo C 3.0 & kernel VGA Pin
David Crow14-Jul-09 9:08
David Crow14-Jul-09 9:08 
QuestionHow to handle drawing into bitmaps and PAINT issues Pin
dhomas13-Jul-09 16:05
dhomas13-Jul-09 16:05 
I've created an application that loads a bitmap, and draws on it using various graphics functions (text, bitmap, etc) depending on various things that the user does (pressing keys, clicking buttons, etc). I was able to implement most everything I wanted to do, but there are problems related to not having used OnPaint, so when other windows cover my window, as expected the graphics I drew disappear. I understand the reason this happens, but I'm not quite sure what the simple work around is.

I can't do all my drawing in OnPaint, because well that would be weird. Smile | :)

I've started with a standard MFC Dialog App with a CStatic control. Here's fake code basics of what I have in OnInit():

CBitmap bmpIntro;
bmpIntro.LoadBitmap(IDB_Intro);

CStatic c_Image;
c_Image.SetBitmap(bmpIntro);

Now, problem #1 is that I want to put some intro text on this bitmap to appear when the window first opens. Putting it in OnInit() or OnPaint() doesn't seem to work.

The other problem is that as things progress, I'm using c_Image.GetDC() to draw all kinds of stuff into the CStatic control, and at any given moment, anything could be displayed depending on what the user initiated. Too much for OnPaint() to know what to recreate.

Since the CStatic already knows how to OnPaint() the original bitmap back into the dialog, is there a way I can draw into the original bitmap, so I don't have to worry about OnPaint() myself? And then somehow tell the CStatic to update itself? Or possibly I draw everything twice, once into the CStatic, and once into the original bitmap it is using.

Again, this seems kludgy, surely there's a more sensible way? And then how also to resolve problem #1?

modified on Monday, July 13, 2009 10:43 PM

AnswerRe: How to handle drawing into bitmaps and PAINT issues Pin
«_Superman_»13-Jul-09 16:57
professional«_Superman_»13-Jul-09 16:57 
GeneralRe: How to handle drawing into bitmaps and PAINT issues Pin
dhomas13-Jul-09 17:03
dhomas13-Jul-09 17:03 
GeneralRe: How to handle drawing into bitmaps and PAINT issues Pin
«_Superman_»13-Jul-09 17:07
professional«_Superman_»13-Jul-09 17:07 
GeneralRe: How to handle drawing into bitmaps and PAINT issues Pin
dhomas13-Jul-09 17:14
dhomas13-Jul-09 17:14 
GeneralRe: How to handle drawing into bitmaps and PAINT issues Pin
«_Superman_»13-Jul-09 17:27
professional«_Superman_»13-Jul-09 17:27 
GeneralRe: How to handle drawing into bitmaps and PAINT issues Pin
dhomas13-Jul-09 17:52
dhomas13-Jul-09 17:52 
GeneralRe: How to handle drawing into bitmaps and PAINT issues Pin
«_Superman_»13-Jul-09 18:03
professional«_Superman_»13-Jul-09 18:03 
GeneralRe: How to handle drawing into bitmaps and PAINT issues Pin
dhomas13-Jul-09 18:07
dhomas13-Jul-09 18:07 
QuestionPausing the Application until a OK Button is pressed? Pin
dipuks13-Jul-09 13:02
dipuks13-Jul-09 13:02 
AnswerRe: Pausing the Application until a OK Button is pressed? Pin
Stuart Dootson13-Jul-09 13:23
professionalStuart Dootson13-Jul-09 13:23 
Questionwhy we can't overload .,->, :: operators? Pin
sam_psycho13-Jul-09 9:51
sam_psycho13-Jul-09 9:51 
AnswerRe: why we can't overload .,->, :: operators? Pin
David Crow13-Jul-09 9:54
David Crow13-Jul-09 9:54 
GeneralRe: why we can't overload .,->, :: operators? Pin
sam_psycho13-Jul-09 10:09
sam_psycho13-Jul-09 10:09 
QuestionVC++ -- Minimize all windows within MDI Pin
blueflame21313-Jul-09 8:38
blueflame21313-Jul-09 8:38 
AnswerRe: VC++ -- Minimize all windows within MDI Pin
David Crow13-Jul-09 9:08
David Crow13-Jul-09 9:08 
GeneralRe: VC++ -- Minimize all windows within MDI Pin
blueflame21313-Jul-09 9:30
blueflame21313-Jul-09 9:30 
QuestionRe: VC++ -- Minimize all windows within MDI Pin
David Crow13-Jul-09 9:33
David Crow13-Jul-09 9:33 

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.