怎样设置按钮的颜色?

hshhgh2 2004-01-05 11:29:23
我的一个基于对话框的程序,现在在界面上放了一个图片,界面上还有按钮,按钮的颜色灰灰的,与图片颜色很不协调,怎么办啊?
...全文
747 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
DebugXP 2004-01-05
  • 打赏
  • 举报
回复
很好用
http://www.vccode.com/file_show.php?id=1764
taianmonkey 2004-01-05
  • 打赏
  • 举报
回复
HBRUSH CDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor==CTLCOLOR_BTN)
{
//pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0,0,0));
//pDC->SetBkColor(RGB(233,233,220));
pDC->SetBkColor(RGB(155,155,155));
HBRUSH b=CreateSolidBrush(RGB(155,155,155));
return b;
}
// TODO: Change any attributes of the DC here
//return m_brush;//.CreateSolidBrush(RGB(255,255,255));
// TODO: Return a different brush if the default is not desired
return hbr;
}
zhangnanonnet 2004-01-05
  • 打赏
  • 举报
回复
http://www.codeproject.com/buttonctrl/cbuttonst.asp
lygfqy 2004-01-05
  • 打赏
  • 举报
回复
不妨用自画的按钮来实现
可以往上放置图片
HengerWu 2004-01-05
  • 打赏
  • 举报
回复
用CBitmapButton
yaolan1999 2004-01-05
  • 打赏
  • 举报
回复
不妨用自画的按钮来实现
將按鈕屬性設為OwerDraw重載DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) ;
void CButtonEx::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
// TODO: Add your code to draw the specified item
CDC *pDC;
pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
CRect rc;
GetClientRect(&rc);
CBrush pbr;
pbr.CreateSolidBrush(RGB(255,0,0));
pDC->FillRect(rc, &pbr);
......
}

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧