how to match the color of a button with its background?

Hi,

I have a owner draw push button.  I associate it with two bitmaps, one 
is down and the other is up.  Is there a way to make the bitmaps's 
background color match the color of the window where the button is 
located.  I manually choose the best matched color but still the result 
is not good.  I can even see a white border line (not drawn by me) when 
the button is pushed.  Please help.  Thanks.

Tony

0
tony6018 (73)
4/20/2004 12:47:25 AM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
559 Views

Similar Articles

[PageSpeed] 12

Check out

http://msdn.microsoft.com/library/en-us/vcresed/html/_asug_choosing_an_opaque_or_transparent_background.asp
0
anonymous (74722)
4/20/2004 3:36:07 PM
May Young <tony@srac.com> wrote in message news:<4084731D.8040808@srac.com>...
> Hi,
> 
> I have a owner draw push button.  I associate it with two bitmaps, one 
> is down and the other is up.  Is there a way to make the bitmaps's 
> background color match the color of the window where the button is 
> located.  I manually choose the best matched color but still the result 
> is not good.  I can even see a white border line (not drawn by me) when 
> the button is pushed.  Please help.  Thanks.
> 
> Tony

Not sure which color you really want.
The button color can be retrieved by using
  = GetSysColor( COLOR_BTNFACE )
The window color can be retrieved by using
  = GetSysColor( COLOR_WINDOW )
The dialog color can be retrieved by using
  = GetSysColor( COLOR_3DFACE )

Of course, this only works if the user hadnt used non system colors,
in which case you might want to use GetParent() to get the buttons
parent and then the background color for it.

Have you tried CBitmapButton?

AndyT
0
4/21/2004 8:02:02 AM
Reply:

Similar Artilces:

voting buttons not recording.
On occasions when voting Yes/No buttons (Outlook 2002) have been used the replies do not always tally on the original sender's e-mail. Any suggestions as to why and any fix. ...

(C# or C++) .NET (MFC Background)
I am by no means a professional programmer. I used to write simple Visual C++ 6 applications about 2-3 years ago and I was comfortable with MFC and Visual C++. Since then I have done very little on programming. Now I am back to programming and reviewing my MFC knowledge which is coming back reltively fast. I am however confused with the new products C# and C++ .NET..? Which one is right for me to build on my relatively good experience with MFC..? Thank you very much. Your help is very much appreciated. FC You can still write ol' fashioned MFC applications using the latest...

MATCH limitations?
How many MATCH commands can be added in one formula? I got an error while I double check this long formula, particulary the ( and ). "The formula.... contains an error..." If I remove a section of MATCH, the MATCH error incicator moves to one MATCH to the back. This is the formula: =IF(ISNUMBER(MATCH(C7,'Batavia Air'!I$7:I$206,0)),'Batavia Air'!$C$1,IF(ISNUMBER(MATCH(C7,'Batavia Air'!Z$35:AC$35,0)),'Batavia Air'!$C$1,IF(ISNUMBER(MATCH(C7,'Multi Structure'!I$7:I$206,0)),'Multi Structure'!$C$1,IF(ISNUMBER(MATCH(C7,'Multi Structur...

Change cell back color on click
This must be very obvious to you guys, but can you advise a newbie to Excel VBA programming (not too bad in Access VBA) how to do the following: I want to click highlight a cell, then click on a button and change the cell back color to say Red ? Simple... any help please ? Thanks Mat Sub TurnRed() Selection.Interior.ColorIndex = 3 End Sub Bob Umlas, MVP FYI, I'll be leading a LIVE 1-hour FREE webinar on tips & tricks on January 27 from 4-5 PM est. It's done from your computer. To find out more & register, go to http://www.iil.com, click on the yellowish rectangle on t...

Move "Close Year" button on Year End Closing window
It's very easy to accidentally click on this button - users have told me that they thought the label on the button said "Close Window". As clicking on the button runs the year-end close without additional warnings, it should be moved. Alternatively, a warning could ask "Are you sure you want to close the year?" ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this lin...

Color change in grafic.
Dear, i have a excelsheet with data that is imported from acces en excel. In this excelsheet i need a grafic with that change color if the some=20 imported data change and go above data. The data is: the results of the month of this year. the results of all months of last year and the budget of those months. The grafiek is a simple grafiek with 1 line and 1 block for every month = that=20 is past for this year. The line is the budget. The blok is the result for month x (in total ad the end of this year = there=20 are 123 blocks. Now my question. Can i let the coler of those blocks change. Th...

Matching Invoices for Commission Reporting
Does anyone have a suggestion of how to combine multiple payable invoices (to vendors) with a receivable (from customer) to automatically apply commissions or run commission reports? R. DeWaal ...

Cannot Merge Duplicate accounts/Match to Existing accounts
I currently use Microsoft Money 2006. I had some technical issues connecting with my bank to download my account information. I contacted my bank and this is what we did to try to resolve the issue and where we currently stand. The first problem we tried to address was the fact that for my bank there were 2 separate "instances" to manage on my online services. Let's call them Bank X and Bank X #4. What we did was "stop using online services" for both. The idea was we should simply deactivate them both and then reestablish the connection under one of the two ...

CRichEditCtrl color : Code not working ?
Hi, the following color changind code is not working... CHARFORMAT cf; cf.crTextColor=RGB(0,0,255); cf.dwMask=CFM_COLOR; cf.cbSize=sizeof(cf); richRecvBox.SetSel(10,1000); richRecvBox.SetSelectionCharFormat(cf); Help ! Dwaach "dwaach" <xbhishek.xsthxnx@gmail.com> wrote in message news:1122285004.634891.64220@g14g2000cwa.googlegroups.com... > Hi, > the following color changind code is not working... > > CHARFORMAT cf; > cf.crTextColor=RGB(0,0,255); > cf.dwMask=CFM_COLOR; > cf.cbSize=sizeof(cf); > richRecvBox.SetSel(10,1000); >...

how to change range for dynamic chart in excel 2000 with button?
i need a help please. i have problem in excel chart. i add data to the table. and then if i want to update my chart i need to change the range too, isn't it? is there any solution for that? i've already use dynamic chart. but it always show data from Jan04 till Jan05. If I add Feb05 it will change from Feb04 to Feb05. what about if i want to see Dec03 till Dec04? is there any command or something else like using macro or vb? thank you in advance.. ivan Ivan, You should be able to set the dynamic chart to show just about any range you want. These articles should help: http://pu...

Newsgroup Button Missing
I tried to modify the 'Go' menu to include the 'News' option. Unfortunately when I dragged the command in, I dropped it over the menu. I dragged it to where it should be but now it has disapeared. It is not even available from the customize dialog. I tried the Detect and Repair utility from the Help menu. but that made no difference. Anyone any ideas? Or is there another way I can open the newsgroup viewer? I think I will make the solution to this problem part of my sig. At least 3 people ask a day... -- ~jason k ______________________________________________________...

Video background in Powerpoint 2010
Would it possible to loop a video in the background across all slides. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/office/community/en-us/default.mspx?mid=b165e82b-3100-466c-a552-0db87dda5099&dg=microsoft.public.powerpoint Yo...

"Disable Send/Receive" button
Office Outlook 2007, SP1 On one of my computers, I was able to customize a button for "Disable Scheduled Send/Receive," but now I can't remember how I found it. I'm trying to customize the same for my notebook. Online searches say that I can find that command under Tool>Send/Receive>Send/Receive Settings, but the only choices I find there are "Define Send/Receive Groups" and "Show Progress." Where's the "Disable Scheduled Send/Receive" command? Thanks! Ken Isaacson SILENT COUNSEL, a legal thriller www.KenIsaacson.com Tools-&g...

MFC code ... X button at top right of dialog/application no longer works
Hello. I've been modifying someone else's MFC code, and the X button at top right of dialog/application no longer works to close the app. What can I do to get this working again ? Thanks ! Look for OnClose(or OnSysCommand) in dialog/mainframe window and see whats going on there. -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "pogo" <pogo@RequestEmailInNewsgroupOnly.com> wrote in message news:2XaMf.25377$UD1.12509@bignews2.bellsouth.net... > Hello. > I've been modifying someone else's MFC code, and the X button at top right > of dialog/application...

Change cell color for valid if statement
When using an "IF" formula and the value is true, how do i change the color in the results cell. I.E. if A6>1,"black", how do i get the cell to turn black and say black You can do it by using Conditional Formatting. Have a look in the below links for more details about it. http://contextures.com/xlCondFormat01.html http://contextures.com/xlCondFormat02.html http://contextures.com/xlCondFormat03.html Remember to Click Yes, if this post helps! -------------------- (Ms-Exl-Learner) -------------------- "Chris H" wrote: > When using...

Index/match help #2
Hi all, going by the example for looking up in a range that isn' sorted in excel help, I get the following examle =INDEX(A2:B5,MATCH("Pears",A2:A5,0),2) It's says that the match statement returns the row id. Is it possibl to replace the column id in the above example so that I can use a matc statement to return a column id as well. I have a table that has severa possible values in different columns. Cheers Sha -- Message posted from http://www.ExcelForum.com Can you give an example? Do you perhaps want to search for the correct column using another MATCH formula on the ...

delete button in a form
I got 3 records in a table and I have a form where the source is based on this table. Now I created a delete button from toolbox wizard and it should delete the current record. If I press that button, the current record on the form is empty out instead of deleted. After deletion, there are 3 records and 1 is all empty. How can I make it deleting a record instead of empty out the record? I am running access 97. Please help. Thanks. Try this code instead of what the wizard wrote: If Me.Dirty Then Me.Undo If Not Me.NewRecord Then RunCommand acCmdDeleteRecord Note that the 3rd r...

how do I freeze colums & rows without the windows button?
Excel 2003 does not have the icon "window", to freeze and unfreeze rows and colums. Is there an alternate way to do this process? Hi AFAIK this icon was never a standard part of any of the toolbars in any version - however you can get to the feature under window / freeze pane menu option or you can add the icon to your toolbars and use this. To add the icon - choose view / toolbars / customize from the menu - choose the commands tab - choose the windows and help category - scroll down the right hand side until you see the icon for freeze panes - click on it and drag it to one...

cell color change based on due date
hi Experts This is 2 part question 1>>> I have a problem in xl, can't figure out. I am using column C named as DUE DATE What I am after is "if difference between today and due date is less than 10 days then the cell colour should change automatically to red!!!!! I have used this > highlighted column C > format > Conditional Formatting >formula is =(C4-today())<=10 format "red colour" (I have selected manually) can't understand what's going wrong there. Another problem is When I have done that first time, then the whole column ...

Outlook 2000/2003 Upgrade : Toolbar buttons / Menu Options
Until recently, I have been running Office 2000 (Outlook 2000) under Windows XP Home on a laptop. I decided to upgrade to Office 2003 (Outlook 2003) via my user account which has administrator privelages. Installation went fine and I followed it up with an upgrade to SP3 (at least, I think it was SP3). I then loaded up Outlook 2003 and did mu usual task of customising the tollbars. I do this by de-selecting the Standard and Formatting toolbars (in the customise tollbars view) and then I create three new toolbars as "username"1, "username"2 and "username"3. This w...

"Next" button for reading NG from Internet
I am using Microsoft's site to read the posts in NG. (http://www.microsoft.com/office/community). There is a minor problem which wastes time. After reading a post, in order to read next one, I have to go back to previous page and click the next post. However if there could be a "Next" button in the end of posts, upon reading a post, it could be easier to go to next post. If possible please add a "Next" button to the end of posts in your NG site. Thanks in advance. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions ...

Description field on enter/match invoice
A long description field on enter/match invoice input screen in Dynamics GP similar to that found on payables transaction entry ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.mspx?...

Special indication color buttons
I need to use some color indication buttons inside my dialog box (not found in the vistual studio editor). Their shape should be circular and I want to change their color. Can someone refer to some sample code? Thanks in advance Vinter HI there! For making Custom Shape Button you have to Use SetWindowRgn Api. and for changing the Color of Button you have to Handle WM_CTLCOLORBTN in Win32 Based Project or WM_CTLCOLOR in MFC Based Project and return the valid Brush both for drawing. Search google for more Custom Button Wrapper ->button site:codeproject.com -- With Regards Alok...

Add buttons in a form from a datasource
Here's the situation: I've got a string array (from a datasource, though that part is really irrelevant). I need to make a option button in a frame on a form for each of these values. Everything I've stumbled into thus far via google and resource books are either for doing it on ActiveSheet (which isn't what I want) or using a Combo/List Box. I really don't want to use a ComboBox or ListBox because my end users prefer the list of option buttons and check boxes, and it needs to be on the form so ActiveSheet is out of the question. Help? -- justagirl ------------------...

My fill color and font color do not work in Excel Std Edition 2003
I recently purchased a new computer with an AMD 64 3200 Proc., MSI Platinum MB & GForce Video Card & installed MS Office Std. Edition 2003 (Dec 2004 App. Student Media). Now fill color and font color will not work in Excel 2003 or Powerpoint 2003, but do work with MS Word 2003. Old Excel docs from my previous computer initially come-up with cells in fill color but when selected the color goes away and will not come back. Any ideas? Thanks, chapstick Hi chapstick Try http://www.contextures.com/xlfaqApp.html#Fill -- Regards Ron de Bruin http://www.rondebruin.nl "chapstic...