标题:一小段程序编译通过,但还是存在问题,帮忙看下
只看楼主
shn521
Rank: 2
等 级:论坛游民
威 望:1
帖 子:56
专家分:52
注 册:2010-6-18
结帖率:73.33%
已结贴  问题点数:20 回复次数:3 
一小段程序编译通过,但还是存在问题,帮忙看下
HBRUSH CCOLORDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
    HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
   
    // TODO: Change any attributes of the DC here
    if(nCtlColor==CTLCOLOR_EDIT);
    pDC->SetTextColor(color);
    // TODO: Return a different brush if the default is not desired
    return hbr;
}

void CCOLORDlg::OnRadio1()
{
    // TODO: Add your control notification handler code here
    color=RGB(255,0,0);
    m_edit.SetFocus();
}

void CCOLORDlg::OnRadio2()
{
    // TODO: Add your control notification handler code here
    color=RGB(0,0,255);
    m_edit.SetFocus();
}

void CCOLORDlg::OnRadio3()
{
    // TODO: Add your control notification handler code here
    color=RGB(0,255,0);
    m_edit.SetFocus();
}

void CCOLORDlg::OnRadio4()
{
    // TODO: Add your control notification handler code here
    color=RGB(255,255,0);
    m_edit.SetFocus();
}
控件变白,点击下就出现错误。
搜索更多相关主题的帖子: 编译 
2010-09-08 19:13
红色警戒
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:19
帖 子:444
专家分:2967
注 册:2005-11-20
得分:20 
按你的代码试过了没有问题

2010-09-08 20:55
shn521
Rank: 2
等 级:论坛游民
威 望:1
帖 子:56
专家分:52
注 册:2010-6-18
得分:0 
以下是引用红色警戒在2010-9-8 20:55:05的发言:

按你的代码试过了没有问题
分分都给你啦
2010-09-10 22:00
laoyang103
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:内蒙古包头
等 级:贵宾
威 望:19
帖 子:3082
专家分:11056
注 册:2010-5-22
得分:0 
大哥  单选框是要用组合和关联整形变量来实现的!  自己上网上查查单选的用法 或者借本书看看。
具体实现:
1.在你的第一个单选框(也就是红色),点属性把组合给打上钩钩。注意:因为四种颜色要作为组合,所以第一个的组合属性打上勾,其他三个都不打钩。
2.然后用switch(关联的整型变量) //为0就是红色。为1就是蓝色  以此类推;
{
    case:0
      //添加用户选择的是红色的代码
    case:1
      // //添加用户选择的是蓝色的代码
.................
     default
.............
}
3.把switch()那部分代码添加到你的消息响应函数中去就OK啦

                                         
===========深入<----------------->浅出============
2010-09-11 23:05



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-319595-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.159270 second(s), 9 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved