未从组合框中选择颜色时显示消息 [英] displaying a Message when colour is not chosen from the combo box

查看:66
本文介绍了未从组合框中选择颜色时显示消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在做一个程序,用于更改从组合框中选择的控件的颜色.我的疑问是,如果在不从组合中选择颜色的情况下单击按钮,则必须显示一条消息选择颜色".我没有收到弹出消息,,,如果我收到弹出消息,控件的颜色没有改变,我也没有犯过我的错误.请改正我,,,
我的编码

Hi ,
Im doing a program for changing the colour of controls selected from the combo box. my doubt is , when push button is clicked without selecting a colour from combo a message must appear " select a colour". im not getting the pop up message,,,if i get the pop up message the control colour is not changing, I dono wat mistake i had done .pls correct me ,,,
My coding

void CComboTestDlg::OnButton1()
{
    int index = m_ColorCombo.GetCurSel();
if(index != CB_ERR)
{
        m_brush.DeleteObject();
        switch(index)
        {
        case 0:
        m_brush.CreateSolidBrush(RGB(0, 240, 120));
        break;
        case 1:
        m_brush.CreateSolidBrush(RGB(128, 0, 240));
        break;
        case 2:
        m_brush.CreateSolidBrush(RGB(0, 128, 0));
        break;
        case 3:
        m_brush.CreateSolidBrush(RGB(128, 128, 0));
        break;
        case 4:
        m_brush.CreateSolidBrush(RGB(0, 0, 128));
        break;
        default:
            m_brush.CreateSolidBrush(::GetSysColor(COLOR_WINDOWTEXT));
            break;
    }
        Invalidate(TRUE);
}
else
        {
        AfxMessageBox("Select A colour");
        }
}


谢谢您

推荐答案

http://www.aspwebpro .com/javascripts/forms/dropdownvalidation.asp [ ^ ]

更多
http://www.aspwebpro.com/javascripts/forms/dropdownvalidation.asp[^]

More here


这篇关于未从组合框中选择颜色时显示消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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