Click here to Skip to main content
16,010,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
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 
Quick answer...

I've defined every key of my piano-keyboard as a region. That means 88 keys(regions).
52 white keys and 36 black keys.

- CRgn-Array as a Member of my Dialog

CRgn KeyRegion[88];

- In the constructor of my dialog I create them all

KeyRegion[KeyNumber].CreateRectRgn();

- so I guess the array gets automatically deleted when destroying the dialog
- should not be leaking...

- In my function OnPaintKeyboard() I paint all my 88 keys

CClientDC dc(this);

CBrush BlackBrush;
BlackBrush.CreateSolidBrush(RGB(0,0,0));
CBrush WhiteBrush;
WhiteBrush.CreateSolidBrush(RGB(255,255,255));

- With...

dc.PaintRgn(&KeyRegion[KeyNumber]);

- I can paint my region in the color of the previous selected Brush-Object e.g.

dc.SelectObject(&BlackBrush);



That looks good to me... - And to you ???

I have a second function OnPaintKey() that paints a single key only - not the whole keyboard.

1 - One Question is wherefrom should I call my OnPaintKeyboard() function so that the whole
keyboard gets painted when the dialog gets visible on screen?

2 - Second Question is wherefrom should I call my OnPaintKeyboard() function so that the whole
keyboard gets correctly redrawn when necessary?(Overlaping windows or Moving and removing out
of the visible screen...)

3 - Third Question: Where can I use my OnPaintKey() function (for a single key!!!) so that not
every key has to be redrawn when only the color of one key changes ?



Manfred




---

Programming is knowing...
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 
GeneralRe: Here's a weird VC++ problem I ran into... Pin
Kannan Kalyanaraman27-Mar-01 19:35
Kannan Kalyanaraman27-Mar-01 19:35 
GeneralWorking with a DataBase Pin
Rafal27-Mar-01 7:56
Rafal27-Mar-01 7:56 
GeneralRe: Working with a DataBase Pin
Dante27-Mar-01 12:08
Dante27-Mar-01 12:08 
GeneralRe: Working with a DataBase Pin
Masaaki Onishi28-Mar-01 14:12
Masaaki Onishi28-Mar-01 14:12 
Generalmissing export SHELL32.DLL:SHGetSpecialFolderPathA Pin
Mustafa Demirhan27-Mar-01 6:39
Mustafa Demirhan27-Mar-01 6:39 
GeneralRe: missing export SHELL32.DLL:SHGetSpecialFolderPathA Pin
BenDev27-Mar-01 7:09
BenDev27-Mar-01 7:09 

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.