如何在vsc8的vc ++ mfc中更改按钮的颜色 [英] how to change color of button in vc++ mfc for vs2008

查看:643
本文介绍了如何在vsc8的vc ++ mfc中更改按钮的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在vsc8中更改vc ++ mfc中的按钮颜色



对不起它不工作请详细说明

您的代码不是请工作,请给我详细信息,其内容

解决方案

1。使用资源编辑器放置按钮

2.使用向导为按钮添加变量(例如m_StopButton)

3.重命名

 CButton m_StopButtonto; 



to

 CMFCButton m_StopButton; 



4.更改一些可见功能



 < span class =code-comment> //  设置按钮文本的背景颜色。 
m_StopButton.SetFaceColor(RGB( 255 0 0 ),);
m_StopButton.SetTextColor(RGB( 0 0 255 ));
// 设置按钮的工具提示。
m_StopButton.SetTooltip(_T ( 这是我的停止按钮!));


还需要包含标题afxbutton.h,即#includeafxbutton.h


使用



 m_Button1.m_nFlatStyle = CMFCButton :: BUTTONSTYLE_NOBORDERS; 





它将删除所有默认的Windows标签。



所以最终解决方案是



 m_Button1.m_nFlatStyle = CMFCButton :: BUTTONSTYLE_NOBORDERS; //需要进行煽动并使用bg颜色
m_Button1.m_bTransparent = false; //使用注册表bg颜色
m_Button1.SetFaceColor(RGB(211,84,0),true );


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

解决方案

1. Place Button with Resource Editor
2. Add Variable for Button (for example m_StopButton ) with Wizard
3. Rename

CButton  m_StopButtonto;


to

CMFCButton  m_StopButton;


4. Change some visible features

// 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!"));


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


Use that

m_Button1.m_nFlatStyle = CMFCButton::BUTTONSTYLE_NOBORDERS;



it will remove all default windows tag.

So Final solution is

	m_Button1.m_nFlatStyle = CMFCButton::BUTTONSTYLE_NOBORDERS;//required for flatering and use bg color
m_Button1.m_bTransparent = false;//reg for use bg color
m_Button1.SetFaceColor( RGB(211, 84, 0), true);


这篇关于如何在vsc8的vc ++ mfc中更改按钮的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆