MFC radiobutton 背景 灰白色怎么去除, 使其变成背景透明的 10
MFC中将RadioButton放置在有背景图片的对话框中,资源属性中设置为透明的,但是结果RadioButton有灰白色的背景去除不掉,请有经验的牛人指导下,谢谢!...
MFC 中 将RadioButton 放置在有背景图片的对话框中, 资源属性中设置为透明的, 但是结果RadioButton有灰白色的背景去除不掉, 请有经验的牛人指导下, 谢谢!
展开
2个回答
展开全部
在你放置radioButton的Dialog对应的类中添加OnCtlColor函数,如下:
HBRUSH CMyDialog::OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor )
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
switch ( pWnd->GetDlgCtrlID() )
{
case RadioButtonID:
{
pDC->SetBkMode(TRANSPARENT);
}
return (HBRUSH)::GetStockObject(NULL_BRUSH);
default:
break;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
记得添加消息映射
HBRUSH CMyDialog::OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor )
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
switch ( pWnd->GetDlgCtrlID() )
{
case RadioButtonID:
{
pDC->SetBkMode(TRANSPARENT);
}
return (HBRUSH)::GetStockObject(NULL_BRUSH);
default:
break;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
记得添加消息映射
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询