Click here to Skip to main content
15,889,867 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionAnyone know how to make something "auto-hide" ? Pin
USAFHokie801-Oct-07 14:07
USAFHokie801-Oct-07 14:07 
AnswerRe: Anyone know how to make something "auto-hide" ? Pin
Hamid_RT1-Oct-07 19:35
Hamid_RT1-Oct-07 19:35 
AnswerRe: Anyone know how to make something "auto-hide" ? Pin
Nelek1-Oct-07 21:42
protectorNelek1-Oct-07 21:42 
QuestionRe: Anyone know how to make something "auto-hide" ? Pin
David Crow2-Oct-07 2:34
David Crow2-Oct-07 2:34 
AnswerRe: Anyone know how to make something "auto-hide" ? Pin
USAFHokie802-Oct-07 12:19
USAFHokie802-Oct-07 12:19 
QuestionFlicker free painting with PNG images Pin
Leslie Sanford1-Oct-07 11:04
Leslie Sanford1-Oct-07 11:04 
AnswerRe: Flicker free painting with PNG images Pin
Mark Salsbery1-Oct-07 12:07
Mark Salsbery1-Oct-07 12:07 
GeneralRe: Flicker free painting with PNG images [modified][solved] Pin
Leslie Sanford1-Oct-07 12:51
Leslie Sanford1-Oct-07 12:51 
Mark Salsbery wrote:
Make sense?


Yes, makes a lot of sense. I have a much clearer picture of what I need to do. Thank you.

One question: Is there an easy way to grab a chunk of the background being displayed by the parent window? The child controls have access to the background bitmap; they could parse a chunk out of the bitmap themselves, but the question is which part. This could all be meticulously worked out beforehand, but it would be cool if each control could just give the parent its coordinates in a CRect, or whatever, and get back a bitmap image of that size.

[EDIT]
Well, I seemed to have solved my problem. The background bitmap is stored as a resource. Each custom control has access to it. The background image is displayed on a static control beneath the custom controls. So what I have each custom control do is convert its client rectangle into a coordinates relative to its parent. It then has its position relative to the background image.

I then do this with a Graphics object in OnPaint:

graphics.DrawImage(background, 0, 0, rect.left, rect.top, rect.right, rect.bottom, UnitPixel);
graphics.DrawImage(&knobImages, 0, 0, 0, knobPosition * KNOB_HEIGHT, KNOB_WIDTH, KNOB_HEIGHT, UnitPixel);


I draw a chunk of the background image followed by the appropriate knob image.

And I'm using the CBufferDC class from this[^] article. Man, I can turn the knobs now and they are flicker free. This rocks!

Thanks, Mark, for your response. It was just what I needed to get me back on track. Big Grin | :-D
[/EDIT]

[EDIT2]
Heh, turns out it's not so effecient to do a Bitmap::FromResource in every control, especially when that bitmap is large. At least it was taking awhile for all of the controls to display themselves, so I just have the main dialog load the bitmap and pass it along to all of the custom controls. Works much faster now.
[/EDIT2]



-- modified at 1:30 Tuesday 2nd October, 2007
GeneralRe: Flicker free painting with PNG images [modified][solved] Pin
Mark Salsbery2-Oct-07 5:12
Mark Salsbery2-Oct-07 5:12 
Questionpragma optimization question. Pin
Maximilien1-Oct-07 7:52
Maximilien1-Oct-07 7:52 
AnswerRe: pragma optimization question. Pin
Chris Losinger1-Oct-07 8:05
professionalChris Losinger1-Oct-07 8:05 
GeneralRe: pragma optimization question. Pin
Maximilien1-Oct-07 8:50
Maximilien1-Oct-07 8:50 
QuestionDeclaring Objects with Default Constructor Pin
Yadrif1-Oct-07 7:05
Yadrif1-Oct-07 7:05 
AnswerRe: Declaring Objects with Default Constructor Pin
Nemanja Trifunovic1-Oct-07 7:18
Nemanja Trifunovic1-Oct-07 7:18 
GeneralRe: Declaring Objects with Default Constructor Pin
Yadrif1-Oct-07 7:26
Yadrif1-Oct-07 7:26 
AnswerRe: Declaring Objects with Default Constructor Pin
Sameerkumar Namdeo1-Oct-07 16:51
Sameerkumar Namdeo1-Oct-07 16:51 
QuestionICCompress key frames on MP42 Pin
od@ananzi.co.za1-Oct-07 6:42
od@ananzi.co.za1-Oct-07 6:42 
Questionstatic objects in classes Pin
cherii1-Oct-07 5:22
cherii1-Oct-07 5:22 
AnswerRe: static objects in classes Pin
Mark Salsbery1-Oct-07 5:26
Mark Salsbery1-Oct-07 5:26 
GeneralRe: static objects in classes Pin
cherii1-Oct-07 5:42
cherii1-Oct-07 5:42 
GeneralRe: static objects in classes Pin
Chris Losinger1-Oct-07 5:48
professionalChris Losinger1-Oct-07 5:48 
GeneralRe: static objects in classes Pin
Mark Salsbery1-Oct-07 5:49
Mark Salsbery1-Oct-07 5:49 
GeneralRe: static objects in classes Pin
cherii1-Oct-07 5:56
cherii1-Oct-07 5:56 
GeneralRe: static objects in classes Pin
Mark Salsbery1-Oct-07 5:58
Mark Salsbery1-Oct-07 5:58 
QuestionC programming - ARRAY Pin
timodc1-Oct-07 4:27
timodc1-Oct-07 4:27 

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.