===菜鸟问题===怎么样使一个Form上的所有控件(edit,button,static..)都显示不同的颜色,字体和大小了??顺便问一下怎么样在button上显 多谢各位高手了~~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 从CButton类里继承一个新类,然后自己画,或者下载别人写好的类 在OnPaint()里面写上想画的东西就可以了 以下代码供你参考:HBRUSH CCtrlPanel::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) {// HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); int ctlId; HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); ctlId=pWnd->GetDlgCtrlID() ; if(nCtlColor == CTLCOLOR_STATIC) { if (ctlId == IDC_PLAYTIME_SLIDER) return hbr; if (ctlId == IDC_PLAY_TIME) { pDC->SetBkMode(TRANSPARENT); //设置背景透明,这样,输出字符的时候就 //是所谓的空心字,而不是有白的底色 pDC->SetTextColor(RGB(255,255,0)); //改变字体的颜色 return HBRUSH(GetStockObject(BLACK_BRUSH)); } pDC->SetBkMode(TRANSPARENT); //设置背景透明,这样,输出字符的时候就 //是所谓的空心字,而不是有白的底色 pDC->SetTextColor(RGB(255,255,0)); //改变字体的颜色 hbr = HBRUSH(GetStockObject(HOLLOW_BRUSH)); } // TODO: Change any attributes of the DC here // TODO: Return a different brush if the default is not desired return hbr;} 以上代码适用于,static,groupbox,edit控件,以上不使用button,button的贴图片参考以下网址http://www.codeproject.com/buttonctrl/ 关于socket的阻塞问题 数据库应用的显示问题 VC2003 为何界面的控件,对话框都没法显示中文,要不乱码,要不就是??这是怎么回事啊? 关于图片去背景显示的效率问题 我的作品,欢迎使用! [请问]:哪里可以找到imgfilt(类似MIME filter)的参考资料? 请问如何读出和写入二进制数据到sql server里去?(用ado) 在vc中向excel2003写 东东如何处理 ? 希望大家帮忙 求助,.ASP文件怎么打开? 属性页中的apply函数重载问题? 哪位知道usb100.h文件是怎么得到的
HBRUSH CCtrlPanel::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
// HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
int ctlId;
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
ctlId=pWnd->GetDlgCtrlID() ;
if(nCtlColor == CTLCOLOR_STATIC)
{
if (ctlId == IDC_PLAYTIME_SLIDER)
return hbr; if (ctlId == IDC_PLAY_TIME)
{
pDC->SetBkMode(TRANSPARENT); //设置背景透明,这样,输出字符的时候就
//是所谓的空心字,而不是有白的底色
pDC->SetTextColor(RGB(255,255,0)); //改变字体的颜色
return HBRUSH(GetStockObject(BLACK_BRUSH));
}
pDC->SetBkMode(TRANSPARENT); //设置背景透明,这样,输出字符的时候就
//是所谓的空心字,而不是有白的底色
pDC->SetTextColor(RGB(255,255,0)); //改变字体的颜色
hbr = HBRUSH(GetStockObject(HOLLOW_BRUSH));
} // TODO: Change any attributes of the DC here
// TODO: Return a different brush if the default is not desired
return hbr;
}