Click here to Skip to main content
15,913,361 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralHelp de-activating system menu in window Pin
Peter Sjöström28-Mar-01 6:49
Peter Sjöström28-Mar-01 6:49 
GeneralRe: Help de-activating system menu in window Pin
Sir Gras of Berger28-Mar-01 9:30
Sir Gras of Berger28-Mar-01 9:30 
GeneralRe: Help de-activating system menu in window Pin
Peter Sjöström28-Mar-01 21:32
Peter Sjöström28-Mar-01 21:32 
GeneralHelp de-activating system menu in window Pin
Peter Sjöström28-Mar-01 6:48
Peter Sjöström28-Mar-01 6:48 
QuestionFlickering...? Pin
Manfred Ramosch28-Mar-01 3:45
Manfred Ramosch28-Mar-01 3:45 
AnswerRe: Flickering...? Pin
Chris Losinger28-Mar-01 8:17
professionalChris Losinger28-Mar-01 8:17 
AnswerRe: Flickering...? Pin
Erik Funkenbusch28-Mar-01 12:42
Erik Funkenbusch28-Mar-01 12:42 
GeneralRe: Flickering...? Pin
Manfred Ramosch29-Mar-01 2:31
Manfred Ramosch29-Mar-01 2:31 
To your first:

Why should I use CPaintDC instead of CClientCD ?
I'm having a dialog-based application and only want to paint a Piano-keyboard onto
the screen. This I will do once when entering the Dialog. At runtime I will change the
colors of single keys so no need for redrawing the whole keyboard - only single keys...


To your second:

I guess with 'deselecting' you mean 'deleting' my pens and brushes. Because deselecting
happens everytime I select a new Object with the SelectObject() function.


So do I get it right now ???

1 - Every DC has at least one original PEN, BRUSH, FONT, BITMAP and RGN.
2 - When creating a new e.g. PEN/BRUSH I have to store the original PEN/BRUSH with

CPen* pOriginalPen = dc.SelectObject(&NewPen);
CBrush* pOriginalBrush = dc.SelectObject(&NewBrush);

3 - and give it back to the DC at the end of the function.

dc.SelectObject(pOriginalPen);
dc.SelectObject(pOriginalBrush);

4 - Every pen, region, font, bitmap or brush created with e.g.

BlackPen.CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
WhitePen.CreatePen(PS_SOLID, 1, RGB(255, 255, 255));
BlackBrush.CreateSolidBrush(RGB(0, 0, 0);
WhiteBrush.CreateSolidBrush(RGB(255, 255, 255);

5 - must explicitely be deleted with
(respectively AFTER having given my OriginalObjects back to the DC)

BlackPen.DeleteObject();
WhitePen.DeleteObject();
BlackBrush.DeleteObject();
WhiteBrush.DeleteObject();

6 - This means the objects are not deleted automatically at the end of the function.


I wonder why this DC related things are relatively difficult in comparison with other
parts of the MFC. I went through all the DC-related SDK and MSDN stuff and through
several books but this is realy not explained rather clearly in any place.

Hope that someone can get me out of this only-one part I do not realy get in my brain.


Thanks


Manfred


---

Programming is knowing... (should be Wink | ;-) )
GeneralRe: Flickering...? Pin
Christian Graus29-Mar-01 3:01
protectorChristian Graus29-Mar-01 3:01 
GeneralRe: Flickering...? Pin
Erik Funkenbusch29-Mar-01 13:23
Erik Funkenbusch29-Mar-01 13:23 
AnswerRe: Flickering...? Pin
Christian Graus28-Mar-01 12:53
protectorChristian Graus28-Mar-01 12:53 
GeneralRe: Flickering...? Pin
Manfred Ramosch29-Mar-01 2:54
Manfred Ramosch29-Mar-01 2:54 
GeneralRe: Flickering...? Pin
Christian Graus29-Mar-01 3:06
protectorChristian Graus29-Mar-01 3:06 
GeneralRe: Flickering...? Pin
Manfred Ramosch29-Mar-01 3:54
Manfred Ramosch29-Mar-01 3:54 
GeneralRe: Flickering...? Pin
Christian Graus29-Mar-01 10:26
protectorChristian Graus29-Mar-01 10:26 
QuestionHow do I completely evict help from my project ? Pin
Christian Graus27-Mar-01 15:34
protectorChristian Graus27-Mar-01 15:34 
AnswerRe: How do I completely evict help from my project ? Pin
l a u r e n27-Mar-01 19:09
l a u r e n27-Mar-01 19:09 
GeneralRe: How do I completely evict help from my project ? Pin
Christian Graus27-Mar-01 19:14
protectorChristian Graus27-Mar-01 19:14 
GeneralRe: How do I completely evict help from my project ? Pin
l a u r e n27-Mar-01 20:06
l a u r e n27-Mar-01 20:06 
GeneralRe: How do I completely evict help from my project ? Pin
28-Mar-01 7:07
suss28-Mar-01 7:07 
AnswerRe: How do I completely evict help from my project ? Pin
Tim Deveaux28-Mar-01 4:04
Tim Deveaux28-Mar-01 4:04 
QuestionIs this likely to be a bug? Pin
Doug27-Mar-01 15:18
Doug27-Mar-01 15:18 
AnswerRe: Is this likely to be a bug? Pin
Michael Dunn27-Mar-01 16:54
sitebuilderMichael Dunn27-Mar-01 16:54 
GeneralHere's a weird VC++ problem I ran into... Pin
Matt Philmon27-Mar-01 9:03
Matt Philmon27-Mar-01 9:03 
GeneralRe: Here's a weird VC++ problem I ran into... Pin
Christian Graus27-Mar-01 11:51
protectorChristian Graus27-Mar-01 11:51 

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.