Solved

VC++4.0: How to lay a .bmp over a button

Posted on 1998-02-12
2
198 Views
Last Modified: 2010-05-18
Using VC++4.0, I have developed a remote control for a camera.
To move the pan/tilt, I use buttons like up/down/left etc.

Now I would like to replace the words "up", "down"...with arrows.
I tried to lay a selfmade .bmp over the button, but it didn't work.

Hope this is not a big problem...till now I used the default control elements from VC++ with individual caption.

Any help would be appreciated !

-Stavi-

In case this is a difficult question, I'll increase the points...
0
Comment
Question by:mitrakis
2 Comments
 
LVL 7

Accepted Solution

by:
galkin earned 50 total points
ID: 1181896
Use CBitmapButton class to set up to 4 bitmaps for each button for enable, disable focused and pushed state of the button. If you want to place only one bitmap on each button the simpliest way to do this is to use ordinary button and call CButton::SetBitmap.
0
 
LVL 3

Author Comment

by:mitrakis
ID: 1181897
Hi galkin,

hope you read this comment...

I need only one bitmap for the button.
So, this is what I changed in my C++ code:

BOOL CDiaKamera::Create()
{
      CButton* pButton;
      BOOL ret;
      
      ret = CDialog::Create(CDiaKamera::IDD);
      pButton = (CButton*) GetDlgItem(IDC_Home);
      pButton->SetBitmap((HBITMAP) GetDlgItem(IDB_HOME));
      return ret;
}

- IDC_Home is my button ID
- IDB_HOME is my bitmap I want to place over this button

...nothing happens...

Do I have to "redraw" the dialog to update the buttons ?

what's wrong here ?

-Stavi-
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now