Solved

Bitmap Button

Posted on 2004-08-10
20
559 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 9
20 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 250 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
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

623 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