Bitmap button question #2

I'm trying to create a bitmap button. Here's what I've done:

1.    Added a CStatic control to my dialog.
2.    Set it's ID to IDC_BMPBUTTON
3.    In the classwizzard, member varialbes tab, created a member variable
m_Button, of type CBitmapButton (I had to manually change this from
CStatic).
4.    In the OnInitDialog(), I've added:
             m_BitmapButton.LoadBitmaps(IDB_BITMAP1, IDB_BITMAP2,
IDB_BITMAP3, IDB_BITMAP4);
             m_BitmapButton.SizeToContent();
             m_BitmapButton.ShowWindow(SW_SHOW);

When I run my dialog, the bitmap appears grey. And which I click on it, the
bn_click handler is not activated.

What am I doing wrong?


0
h.dean (65)
4/21/2004 4:07:03 AM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
553 Views

Similar Articles

[PageSpeed] 10

Why you didn't add a CButton control but a CStatic control

"Hamish Dean" <h.dean@xtra.co.nz> wrote in message
news:urmhc.987$_s.36189@news.xtra.co.nz...
> I'm trying to create a bitmap button. Here's what I've done:
>
> 1.    Added a CStatic control to my dialog.
> 2.    Set it's ID to IDC_BMPBUTTON
> 3.    In the classwizzard, member varialbes tab, created a member variable
> m_Button, of type CBitmapButton (I had to manually change this from
> CStatic).
> 4.    In the OnInitDialog(), I've added:
>              m_BitmapButton.LoadBitmaps(IDB_BITMAP1, IDB_BITMAP2,
> IDB_BITMAP3, IDB_BITMAP4);
>              m_BitmapButton.SizeToContent();
>              m_BitmapButton.ShowWindow(SW_SHOW);
>
> When I run my dialog, the bitmap appears grey. And which I click on it,
the
> bn_click handler is not activated.
>
> What am I doing wrong?
>
>


0
kevinlu (9)
4/21/2004 4:48:49 AM
> Why you didn't add a CButton control but a CStatic control

i have tried that also. still not showing my bitmap(s).


0
h.dean (65)
4/21/2004 6:11:20 AM
> I'm trying to create a bitmap button. Here's what I've done:
>
> 1.    Added a CStatic control to my dialog.
> 2.    Set it's ID to IDC_BMPBUTTON
> 3.    In the classwizzard, member varialbes tab, created a member variable
> m_Button, of type CBitmapButton (I had to manually change this from
> CStatic).
> 4.    In the OnInitDialog(), I've added:
>              m_BitmapButton.LoadBitmaps(IDB_BITMAP1, IDB_BITMAP2,
> IDB_BITMAP3, IDB_BITMAP4);
>              m_BitmapButton.SizeToContent();
>              m_BitmapButton.ShowWindow(SW_SHOW);
>
> When I run my dialog, the bitmap appears grey. And which I click on it,
the
> bn_click handler is not activated.
>
> What am I doing wrong?

I have now changed #1 to adding a CButton, with the bitmap option checked.
The button is automatically resizing to the size of my bitmap, but is still
showing the bitmap as grey.


0
h.dean (65)
4/21/2004 6:16:37 AM
Have creat a class to draw the button yourself ,then you should check the
ownerdraw in the button styles.
"Hamish Dean" <h.dean@xtra.co.nz> wrote in message
news:Xkohc.1104$_s.37298@news.xtra.co.nz...
> > I'm trying to create a bitmap button. Here's what I've done:
> >
> > 1.    Added a CStatic control to my dialog.
> > 2.    Set it's ID to IDC_BMPBUTTON
> > 3.    In the classwizzard, member varialbes tab, created a member
variable
> > m_Button, of type CBitmapButton (I had to manually change this from
> > CStatic).
> > 4.    In the OnInitDialog(), I've added:
> >              m_BitmapButton.LoadBitmaps(IDB_BITMAP1, IDB_BITMAP2,
> > IDB_BITMAP3, IDB_BITMAP4);
> >              m_BitmapButton.SizeToContent();
> >              m_BitmapButton.ShowWindow(SW_SHOW);
> >
> > When I run my dialog, the bitmap appears grey. And which I click on it,
> the
> > bn_click handler is not activated.
> >
> > What am I doing wrong?
>
> I have now changed #1 to adding a CButton, with the bitmap option checked.
> The button is automatically resizing to the size of my bitmap, but is
still
> showing the bitmap as grey.
>
>


0
kevinlu (9)
4/21/2004 6:44:27 AM
Check out Example 12 and 18

http://www.railjonrogut.com/mfc_link.html

    Rail
-- 
      Recording Engineer/Software Developer
      Rail Jon Rogut Software
      http://www.railjonrogut.com
      mailto:rail@railjonrogut.com

"Hamish Dean" <h.dean@xtra.co.nz> wrote in message
news:urmhc.987$_s.36189@news.xtra.co.nz...
> I'm trying to create a bitmap button. Here's what I've done:
>
> 1.    Added a CStatic control to my dialog.
> 2.    Set it's ID to IDC_BMPBUTTON
> 3.    In the classwizzard, member varialbes tab, created a member variable
> m_Button, of type CBitmapButton (I had to manually change this from
> CStatic).
> 4.    In the OnInitDialog(), I've added:
>              m_BitmapButton.LoadBitmaps(IDB_BITMAP1, IDB_BITMAP2,
> IDB_BITMAP3, IDB_BITMAP4);
>              m_BitmapButton.SizeToContent();
>              m_BitmapButton.ShowWindow(SW_SHOW);
>
> When I run my dialog, the bitmap appears grey. And which I click on it,
the
> bn_click handler is not activated.
>
> What am I doing wrong?
>
>


0
railro (128)
4/21/2004 8:25:22 AM
Unless you are doing this as an intellectual exercise, here is an excellent
bitmap button by Joseph Newcomer.
This is much better that Microsoft's.

Best Regards
Julian N.

http://www.flounder.com/bitmapbutton.htm
"Hamish Dean" <h.dean@xtra.co.nz> wrote in message
news:urmhc.987$_s.36189@news.xtra.co.nz...
> I'm trying to create a bitmap button. Here's what I've done:
>
> 1.    Added a CStatic control to my dialog.
> 2.    Set it's ID to IDC_BMPBUTTON
> 3.    In the classwizzard, member varialbes tab, created a member variable
> m_Button, of type CBitmapButton (I had to manually change this from
> CStatic).
> 4.    In the OnInitDialog(), I've added:
>              m_BitmapButton.LoadBitmaps(IDB_BITMAP1, IDB_BITMAP2,
> IDB_BITMAP3, IDB_BITMAP4);
>              m_BitmapButton.SizeToContent();
>              m_BitmapButton.ShowWindow(SW_SHOW);
>
> When I run my dialog, the bitmap appears grey. And which I click on it,
the
> bn_click handler is not activated.
>
> What am I doing wrong?
>
>


0
4/21/2004 11:01:56 AM
Reply:

Similar Artilces:

Bitmap
hi, I display a bitmap on my sdi client area and I want to draw on the bitmap in transparent mode so the area I draw above the bitmap only will change the bitmap pixel color so I can still see the bitmap ant the line I draw above it, How can I do that??? Thanks Not sure if I understand your question, but if you are trying to draw on top of your image simply do the following. In OnDraw(...) //First Draw your bitmap pDC->Bltbit(..) //Then Draw your line code or other GDI functions pDC->MoveTo(...) pDC->LineTo(...) Every time OnDraw(...) gets called it will refresh your image an...

ListView question #3
Hi, I've searched on internet to find some tips how to detect when a ListView: - draw the headers (if it is header, and for which column) - draw the rows (which row / index) - draw items (to which column belongs the drawed item) i've read some articles about subclassing WndProc. I've checked that way but it's huge amount of time spent and result is really poor :-( i would like to know if there is not another way...a little bit easier Topics behind that are : - allow different types of items (not only text, but also progress bars, spinboxes,..) - Customize the header (imag...

disabling toolbar buttons????
I am extremely frustrated. I have spent FIFTEEN HOURS (and counting) trying to do something that should be simple. I have an MDI program. Its a graphics program. I have a toolbar with 2 buttons: a pointer and magnifier. I've added both the COMMAND and UPDATE_COMMAND_UI functions for these buttons. When the program first starts, the toolbar is there, but grayed out. Great. When you open a document(bmp), both the pointer and magnifier become enabled. Great. When you close all documents(bmps), i would like for the 2 toolbar buttons to look grayed out again, as they do when the pro...

Spelling check #2
Is there anyway to change my Outlook Express spell checking program. It checks all my email for French Spelling and not English spelling and I need the English. Thank you, "Brian" <anonymous@discussions.microsoft.com> wrote in message news:7d0401c3f0f0$f1f8fd70$7d02280a@phx.gbl... > Is there anyway to change my Outlook Express spell > checking program. It checks all my email for French > Spelling and not English spelling and I need the English. > > Thank you, > > This newsgroup is for support of Outlook 97/98/2000/2002/2003 from the Office suite of p...

Userproperty question
If I don't want to process certain emails is an Inbox folder, is one method of doing so while scanning the folder's emails is to check the value of a userproperty? For example, if the property doesn't exist, process it and add the userproperty else skip? That's one possible way. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Salad" <salad@oilandvinegar.com> wrote in message news:MY...

FindRecord Control Button
i built a find record control button so a user can type in the form number and go there but it only searches the field that the cursor is in and the form # is not on the tab order(purposely). How can i specify where the find record function searches? thanks Ryan, usually people use an unbound combo box or an unbound text box for searching. There is a sample download with code of a search form at http://www.allenbrowne.com/ser-62.html If you need help to get it working, post back. You can also use the wizard to put a combo for searching on your form. On the form in design view, click the...

timer button
Hello, We are moving from Outlook to CRM. One thing that we used heavily is the Outlook Journal timer. It appears you need to type in the amount of time in crm. Is there anyway to get timer functionality on CRM tasks? Thanks! Matt No such feature in v1.2 "out of box". Option is to look for 3rd Party ISV or custom build via SDK.. Good luck. Frank Lee Workopia, Inc. www.workopia.com "Matt Landis" wrote: > Hello, > > We are moving from Outlook to CRM. One thing that we used heavily is the > Outlook Journal timer. > > It appears you need to ...

how do I make a calendar with every three days a different color . #2
I work 3 days on and 3 days off . How can I make a calender reflecting this using 2 colors without physically editing each day? Put the following forumula in a cell adjacent to the dates on your calendar: =Mod("date"/6,1). It will yield 6 results, .333...,.5,.666...,.833..., 0,.166..., where "date" is the numeric value for that given date. Use conditional formatting to mark the date. For the date that results in ..333... set the conditional formatting to Formula Is with the formula "=A8=(1/3)" (set to the address for your formula) and set to ...

Index/Match question
I have a table that looks like this: January February Currency 1 Text 1 1.1000 2.1000 Text 2 1.2000 2.2000 Text 3 1.3000 2.3000 Currency 2 Text 1 1.1200 2.1200 Text 2 1.2200 2.2200 Text 3 1.2300 2.2300 On sheet 2, I want cell B1 to return 2.2000 if I have Currency 1 in cell A1, Text 2 in cell A2, and February in cell A3. I tried index/match but I'm struggling due to the fact there are 3 parameters. Also, column A of the data table has blank cells. This table is emailed to me weekly and is rather large. Is there a way to make a formula work without ...

Outlook Express launches Word when Send button is pressed
After recently having some software issues, and then resolving them, my Outlook Express lauches Word whenever I try to send email. How can I disable this? Why is it happening? replace anonymous with mbschwartz2 for my email. Thank you. ...

Exchange installation question
Greetings, We are considering going to Exchange from Groupwise. We currently have AD on a Windows 2000 infrastructure. My question is if we installed Exchange 2003 on windows 2000, can anyone share their thoughts on later upgrading the os to 2003? It would probably make sense to upgrade the network now, then install exchange, but we're in a crunch at the moment and need to get this e-mail project going. Thanks! Chris Starting afresh with a new OS install is always preferable, but not always possible. Can upgrade OS later if that's the case, the only issue is unavailability of cer...

bitmaps
hi, i actually want to display the bitmap image in picture box and does not wants its scope to be destroyed.i want to do this only in vc++6 and does not want to do with any third party tools.how can i do it? thanks a lot to Ajay kalra for a very great support given to this group. thanks in advance susi. CString szFilename ("D:\\abc2.bmp"); HBITMAP hBmp = (HBITMAP)::LoadImage( NULL, szFilename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION ); //pointer to a static...

device driver question!
Hi: When device driver was activated by the API "ActivateDeviceEx", the DllEntry was called or not? I had added a "debug msg" statement in the DllEntry try to find out the Device driver DLL was loaded or not, but this mark (DEBUGMSG/ RETAILMSG) was never shown it!. However, xxx_Iint's debug message was shown, and same as xxx_Open! So How this DLL was loaded? why DllEntry is not entry point? Thanks Lu On Jun 7, 2:54=A0pm, ydlu <yudian...@gmail.com> wrote: > When device driver was activated by the API "ActivateDeviceEx", the > DllE...

Updating Money Deluxe 2007 question
Will Microsoft keep the Money updates available permanently, as they do with updates for old operating systems like Windows 98? The reason I ask is that, at least in my experience, Money updates have never been a manually downloadable file, but rather once you install the program, Money calls out on the Internet and looks for updates. If Microsoft doesn't keep the updates online, is there any way to download the update files now for permanent keeping? I did a test. I installed Money 2007 Deluxe on my Virtual PC. As soon as I went into the program after installation, it updated ...

Toolbar button without bitmap only text
Hello All I want to display only text in the tool bar buttons without bitmap how shall i do that Thanks in advace Faisal Try the following to your toolbar object: SendMessage(TB_SETIMAGELIST, 0, NULL); -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "Faisal Masoor" <fmansoor@softpak.com> wrote in message news:uOstAT7TEHA.2464@TK2MSFTNGP10.phx.gbl... > Hello All > > I want to display only text in the tool bar buttons without bitmap how shall > i do that > > Thanks in advace > Faisal > > Thanks Ajay But it didn't worked any more ideas Fa...

2 questions #2
hello, Here is my first question,money plus keeps downloading my statement but will only use 1 payee.How do i fix this. Question 2 Money has decided that it will now import my statement for my checking account and put it into my savings account.How do i fix this I am using money plus deluxe version 17.0.120.1415 purchased in the us and i have been using this program for almost a year.Any help would be appreciated In microsoft.public.money, sondra99999 wrote: >hello, > Here is my first question,money plus keeps downloading my statement but >will only use 1 payee.How ...

Managing Lists #2
Thanks for your help guys. For future reference i applied the firs solution and it worked perfectly. Many thank -- iwilki ----------------------------------------------------------------------- iwilkin's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1607 View this thread: http://www.excelforum.com/showthread.php?threadid=27526 Glad to hear that ! Thanks for the feedback (from us) -- Rgds Max xl 97 --- Please respond in thread xdemechanik <at>yahoo<dot>com ---- "iwilkin" <iwilkin.1f8sda@excelforum-nospam.com> wrote in message news:...

POS 2.0 to RMS 2.0 migration
Are there any tools out there (upgrade programs, SQL Scripts, KnowledgeBase articles) whch will allow a POS 2.0 system (not POS2009) to be migrated to RMS 2.0? Can't go into the details, but we have someone who is currently running POS 2.0 at three separate locations and may want to move to RMS and bring these disparate locations under the Headquarters umbrella. -- Bill Yater Blue Horseshoe Solutions byater@bhsolutions.com None that I have seen, Best option export everything to a CSV, and say goodbye to sales history. I am sure there is someone that could move all the info for y...

should i copy the bitmap header info when i wanna copy the bitmap data to global memory
now what i can get is the CBitmap, i wanna save it to global memory block ,so i can resuse it elsewhere, how could i achieve this? should i copy the bitmapheadinfo,and how??i can only get width, height info from CBitmap class Do you need the information in the bitmap header? joe On 6 Sep 2006 01:34:56 -0700, "thinktwice" <memorialday@gmail.com> wrote: >now what i can get is the CBitmap, i wanna save it to global memory >block ,so i can resuse it elsewhere, how could i achieve this? should i >copy the bitmapheadinfo,and how??i can only get width, height info fro...

Log-log charts #2
Hi, I'm using Excel 2002 and am trying to create a simple log-log plot. Making the y-axis logarithmic is easy - it's a check-box option under Scale tab of the Format Axis dialog. But for the X axis the dialog does not have that option. My XY data is valid (all positive values). There's web sites that say you can do this (e.g. http://cstl-cst.semo.edu/venezian/Utilities/graphs.htm). Why doesn't my Excel support it??? Any help is appreciated. Walt Hi Walt, Sounds like your chart maybe a line chart (x-axis is category) instead of true xy scatter. Right click the chart...

e-mail distribution group question
Here's the situation: User A's incoming e-mail are delivered to user A and user B. User B's incoming e-mails are also delivered to user C. BUT user C does not want user A's e-mails... At the moment User C gets both user A and B's e-mails Is there a way I can set this up? Many thanks M Hi, Do they need to receieve copies of others emails in their own mailbox? You could give permissions to read the other users mailboxes. Then you of your clients would just need to add them as an additional mailbox in Outlook. The other option is to create a server side rule in outl...

How to enter output range for Descriptive statistice #2
Hi I'm trying to get Descriptive statistics summary, and couldn't enter output range. what is the formate? Hi, You just need to click on (or enter) the upper left cell where you want the data to appear, usually to the right of, or below, your data. Dave url:http://www.ureader.com/msg/10296114.aspx ...

Resizing bitmap without losing quality (or a method to redraw the bitmap)
I have a 2d real time oscilloscope (a bitmap created with CDC CreateCompatibleDc and so on...). I need to resize to a bigger image and back to original size when the user click one of two button (like a zoom). I have tried with StretchBlt, but the image is very poor in quality. I can create a new bitmap of the desired size for perfect quality, but in this way a lose the graph that is displayed on first bitmap. Is it possible to resize the bitmap wihout losing too much or do something that allow me not to lose the 2d graph drawed on it? roby.schwarz@libero.it wrote: > I have a 2d real tim...

use picture as a button
is it possible to have a picture as a button to take the user to another page? (using a macro)? You could even assign it a hyperlink! ash wrote: > > is it possible to have a picture as a button to take the > user to another page? (using a macro)? -- Dave Peterson ec35720@msn.com Hello Ash This won't turn your picture into a button, someone with more experience can help you with that but below is what I generated with the macro recoreder. HTH Mark (InWales) Sub Picture_Press() ' Picture_Press Macro recorded 14/09/04 'unprotect worksheet it doesn't appear to wo...

xmlreader question
Hello, I have: writer = XmlWriter.Create("mike.xml",settings); // ......Do Some stuff. This works writes an xml file. // Then I try to close it writer.Flush(); writer.Close(); //But I get an error saying I cant open it, its being used FileStream fs = new FileStream("mike.xml", FileMode.Open); ....More stuff What am I missing? Thanks "AMP" <ampeloso@gmail.com> wrote in message news:4ffc568b-828d-4c40-b5a2-1239b0928c91@k19g2000yqc.googlegroups.com... ...