Link to home
Start Free TrialLog in
Avatar of israel022697
israel022697

asked on

CStatic and SetBitmap

Hi,

I'm trying to make a dialog just like the one you get when you insert the Visual Studio disc into the CD driver

I'm using CStatic for "button" which is actually only a bitmap.
I'm using OnMouseMove and can recognize if the mouse pointer is on a "button" or not and if it is, I'm using SetBitmap to change
the "button's" bitmap.

The problem is that some times, not always !, there change between the bitmaps is not smooth and there is a flickering effect.

My questin is, can I avoid this ??

Thanks in advance

Israel
ASKER CERTIFIED SOLUTION
Avatar of prasanth
prasanth

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just using CBitmapButton won't completely help you.  It will only let you define focus/non-focus/down/disabled bitmaps, but they are relatively flicker free.  

The only way to use a CBitmapButton is to physically change the button from a 'up' bitmap to a 'focus' bitmap when moved over.

Now the trick is to override the CBitmapButton and replace it with your own function.  When you move the mouse over a button, you'll want to delete the old bitmap image and load up the new image.  Take a look at the CBitmapButton source code and you'll see that all you have to do.  A quickie rememberance is take the 'up' bitmap, do a DeleteObject on it, load it back up with a LoadBitmap, and the button should update itself 'hopefully' cleanly.  

I have some code up at work that will help you, but I'm not there right now.

Phillip