Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Bitmap Button

Posted on 2004-08-10
20
Medium Priority
?
561 Views
Last Modified: 2013-12-03
Can I implement a bitmap button with EVC. If so, how? If not, what other ways can I implement a bitmap on a button?
0
Comment
Question by:mwcmp
  • 11
  • 9
20 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 1000 total points
ID: 11762882
Yes you can, but it is different from VC.

First create a dialog template with a button, set owner-draw attribute to on, give it a caption label, let's say "MYBUTTON"

Then, create 3 bitmaps named "MYBUTTOND", "MYBUTTONF", "MYBUTTONU" for down, focused and up states, respectively.

(continues)
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11763053
Sorry, I was bussy.

(continues)

Then, create  a CBitmapButton object in you dialog object, let's say m_MyButton. Don't declare it in ClassWizard.

Inside the OnInitDialog() function, use:

   m_MyButton.AutoLoad(ID_MYBUTTON, this);

I think is enough.
Good luck,
Jaime.
0
 

Author Comment

by:mwcmp
ID: 11764716
What is a dialog template?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11764798
The dialog resource.
0
 

Author Comment

by:mwcmp
ID: 11765027
just a CDialog?
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11765081
a CDialog or CPropertyPage derived class, the same.
0
 

Author Comment

by:mwcmp
ID: 11765238
erm.. I think the 3 bitmaps are yet to be link with the button. Am I right?
0
 

Author Comment

by:mwcmp
ID: 11765285
Do I do this? I suppose.. :)
m_myButton.LoadBitmaps(MYBUTTONU, MYBUTTOND, MYBUTTONF);
0
 

Author Comment

by:mwcmp
ID: 11765319
Hmm...
I only get a grey patch on my dialog. The grey patch is where the button had been drew.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11765346
>erm.. I think the 3 bitmaps are yet to be link with the button. Am I right?
Yes

>Do I do this? I suppose.. :)
>m_myButton.LoadBitmaps(MYBUTTONU, MYBUTTOND, MYBUTTONF);
No, don't do it. Just use:

   m_MyButton.AutoLoad(ID_MYBUTTON, this);        (inside the OnInitDialog)

0
 

Author Comment

by:mwcmp
ID: 11765447
still the same results...
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11765529
Have you declared m_MyButton as CBitmapButton?

In the dialog resource:
In the caption label of the button, don't use quotes
Also declare button id as ID_MYBUTTON .
0
 

Author Comment

by:mwcmp
ID: 11765636
ya...
1) create dialog with button
2) set button to owner draw and caption as MYBUTTON and id as ID_MYBUTTON
3) 3 bitmaps created
4) declared CBitmapButton m_MyButton;
5) in OnInitDialog, m_MyButton.AutoLoad(ID_MYBUTTON, this);
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11765752
1) the 3 buttons you have created have string labels?  "MYBUTTONU", etc... Them must be string, don't use an identifier.
2) I suppose you have not declared it in the ClassWizard as a member variable.
 
0
 

Author Comment

by:mwcmp
ID: 11765792
Do you mean that I have to create the 3 bitmaps with CBitmap? If so, how do I link the bitmap (member variable) with my bitmaps?
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11765865
>Do you mean that I have to create the 3 bitmaps with CBitmap? If so, how do I link the bitmap (member variable) with my bitmaps?
No.

I think this could be your problem: Is your button implemented? If not, it is in disabled state.
Just associate it with a Message Handler in the ClassWizard (don't create a associated variable there).
Also you can create a bitmap for disabled state: "MYBUTTONX"

 
0
 

Author Comment

by:mwcmp
ID: 11765974
Got it, the problem lies in the string identifier. Sorry.
Can you tell me briefly how it works? I mean this is much simpler as what I had been searching around and found. All of them have long codes.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11766182
0
 

Author Comment

by:mwcmp
ID: 11766236
Those are what I had been trying too. But I am wondering, how the bitmap get link to the button in this case.
0
 

Author Comment

by:mwcmp
ID: 11766251
I guess I had missed the most maual method. Thanks. :)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

916 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