You are on page 1of 7

12,485,882 members (47,356 online)

Sign in

Search for articles, questions, tips

home

articles

quick answers

discussions

Ask a Question

features

community

All Questions All Unanswered

help

FAQ

how to change color of button in


vc++ mfc for vs2008
See more:

MFC

VisualC++

Rate this:

how to change color of button in vc++ mfc for vs2008


Sorry Its not working please give details please
Your code is not working please give me details please please,Its urget

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

Top Experts
Last 24hrs

Posted 31-Jan-13 2:51am Updated 12-Feb-13 20:13pm v3


debarunb 1.2K

This month

Sergey Alexand 584 OriginalGriff

Add a Solution

OriginalGriff

360 ppolymorphe

2,449

CPallini

300 Maciej Los

2,153

ppolymorphe

290 Sergey Alexand 1,702

Karthik Bangalore 280 David_Wimbley

Comments
Maximilien 31-Jan-13 9:26am

4,212

1,246

Also Read

What have you tried so far ? w hat did your google searches returned ?

Follow the Money: Big Data


ROI and Inline Analytics

2 solutions
Solution 4

Top Rated

Most Recent
Six Reasons to Upgrade Your
Database

Rate this:

1. Place Button with Resource Editor


2. Add Variable for Button (for example m_StopButton ) with Wizard
3. Rename
Hide Copy Code

CButton

m_StopButtonto;

Changing the color of fonts in Menu vc++/MFC

to
Hide Copy Code

CMFCButton m_StopButton;
open in browser PRO version Are you a developer? Try out the HTML to PDF API

Related Questions
How Change the back color of Radio Button as
dialog color
pdfcrowd.com

Change default back color of tab control in


vc++ mfc

4. Change some visible features


Hide Copy Code

// Set the background color for the button text.


m_StopButton.SetFaceColor(RGB(255,0,0),true);
m_StopButton.SetTextColor(RGB(0,0,255));
// Set the tooltip of the button.
m_StopButton.SetTooltip(_T("This is my Stop Button!"));

How to Change the color of an MFC


Issue in porting VC++ application to VS2008
How to color the button on mouse move in mfc
Give color to dialogs and buttons
Change the Button color
change color to button

Posted 31-Jan-13 9:11am


merano 4.2K

Updated 31-Jan-13 13:43pm v3

VS2008 C++ AppWizard Changing MFC DLL to


Static Link

Comments
Gbenbam 3-Aug-15 10:33am
I used this code on VS2010 but id did not seem to w ork.
I added an MFC button from the resource editor and w rote.
CMFCButton *pButton = (CMFCButton *)GetDlgItem(IDC_MFCBUTTON1);
pButton->StFaceColor(RGB(255,0,0),true);
pButton->SetTextColor(RGB(0,0,255));
I w onder w hy the code doesn't seem to w ork.

m erano 3-Aug-15 13:35pm


(1)Note that the background is not filled w hen the CMFCButton::m_bTransparent
member variable is TRUE.
https://msdn.microsoft.com/de-de/library/Bb983413.aspx

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

(2)SetFaceColor() is ignored by modern theme engines. The w izard greates


something like:
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindow s));
You can comment this line out to disable custom MFC themes. This w orks, but the
button
w ill not look good because of classic theme.
Possibly you can Load a Color-Bitmap to get the color you w ant.
Another solution w ould be to do an ow nerdraw button - handling the OnDraw Item()
or WM_DRAWITEM
message and do the painting yourself.

Solution 5

Rate this:

It is also needed to include the header afxbutton.h, i.e. #include


"afxbutton.h"

Posted 17-Apr-13 7:28am


ToniMachado 422

Add your solution here


open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

S small BIG code var <

>

& link [^] encode untab

case indent outdent

Preview

Existing Members

...or Join us

Sign in to your account

Download, Vote, Comment, Publish.

Your Email

Your Email

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

Password

Optional Password
Forgot your password?
I have read and agree to the
and Privacy Policy
Please subscribe me to the CodeProject
newsletters

Submit your solution!


When answering a question please:
1. Read the question carefully.
2. Understand that English isn't everyone's first language so be
lenient of bad spelling and grammar.
3. If a question is poorly phrased then either ask for clarification,
ignore it, or edit the question and fix the problem. Insults
are not welcome.
Let's work to help developers, not make them feel stupid.

This content, along with any associated source code and files, is licensed under The
Code Project Open License (CPOL)

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

Advertise | Privacy | Mobile


Web01 | 2.8.160904.1 | Last Updated 17 Apr 2013

Layout: fixed | fluid

Copyright CodeProject, 1999-2016


All Rights Reserved. Terms of Service

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

You might also like