WINCE中微调按键和编辑框的绑定问题
来源:互联网 发布:2016年nba总决赛数据 编辑:程序博客网 时间:2024/05/22 13:57
设计一个wince应用程序,要求有三个微调按钮和编辑框,用来调整颜色搭配。
首先我们放置三对微调按钮和编辑框,并在初始化中绑定
BOOL CSpinUseDlg::OnInitDialog(){CDialog::OnInitDialog();// Set the icon for this dialog. The framework does this automatically// when the application's main window is not a dialogSetIcon(m_hIcon, TRUE);// Set big iconSetIcon(m_hIcon, FALSE);// Set small icon// TODO: Add extra initialization hereCSpinButtonCtrl *pSpinRed = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_RED);ASSERT(pSpinRed!=NULL);pSpinRed->SetBuddy(GetDlgItem(IDC_EDT_RED));pSpinRed->SetRange(0,255);pSpinRed->SetPos(128);CSpinButtonCtrl *pSpinGreen = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_GREEN);ASSERT(pSpinGreen!=NULL);pSpinGreen->SetBuddy(GetDlgItem(IDC_EDT_GREEN));pSpinGreen->SetRange(0,255);pSpinGreen->SetPos(128);CSpinButtonCtrl *pSpinBlue = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_BLUE);ASSERT(pSpinBlue!=NULL);pSpinBlue->SetBuddy(GetDlgItem(IDC_EDT_BLUE));pSpinBlue->SetRange(0,255);pSpinBlue->SetPos(128);return TRUE; // return TRUE unless you set the focus to a control}
消息处理函数:
void CSpinUseDlg::RGBColorChange() {UpdateData(TRUE);CBrush colorBrush;COLORREF clRGB; clRGB = RGB(m_red,m_green,m_blue);CClientDC * pClientDC;pClientDC = new CClientDC(this);colorBrush.CreateSolidBrush(clRGB);CRect rect(80,120,160,200);pClientDC->FillRect(rect,&colorBrush);delete pClientDC;}void CSpinUseDlg::OnEnChangeEdtRed(){RGBColorChange();// send this notification unless you override the CDialog::OnInitDialog()// function and call CRichEditCtrl().SetEventMask()// with the ENM_CHANGE flag ORed into the mask.// TODO: Add your control notification handler code here}void CSpinUseDlg::OnEnChangeEdtGreen(){RGBColorChange();// send this notification unless you override the CDialog::OnInitDialog()// function and call CRichEditCtrl().SetEventMask()// with the ENM_CHANGE flag ORed into the mask.// TODO: Add your control notification handler code here}void CSpinUseDlg::OnEnChangeEdtBlue(){RGBColorChange();// send this notification unless you override the CDialog::OnInitDialog()// function and call CRichEditCtrl().SetEventMask()// with the ENM_CHANGE flag ORed into the mask.// TODO: Add your control notification handler code here}设置三个变量,分别关联三个颜色值,范围是0-255,整数。
public:BYTE m_red; //BYTE m_green; //BYTE m_blue; //
void CSpinUseDlg::DoDataExchange(CDataExchange* pDX){CDialog::DoDataExchange(pDX);DDX_Text(pDX, IDC_EDT_RED, m_red);DDV_MinMaxByte(pDX, m_red, 0, 255);DDX_Text(pDX, IDC_EDT_GREEN, m_green);DDV_MinMaxByte(pDX, m_green, 0, 255);DDX_Text(pDX, IDC_EDT_BLUE, m_blue);DDV_MinMaxByte(pDX, m_blue, 0, 25
运行程序,发现微调按键并不能调整编辑框的值,先前的绑定语句没有起作用。
一番查找后,问题解决了,在微调按钮的属性里面需要设置Set buddy integer为ture,程序正常运行,绑定成功。
- WINCE中微调按键和编辑框的绑定问题
- WINCE中编辑框(CEdit)的“奇怪现象”
- DataGridView绑定 DataTable 编辑的问题
- WINCE系统中WINFORM的按键事件的使用方法简介
- 汇编修改精灵注解之按键微调功能的使用方法:
- wince 下的按键驱动
- wince按键中断的检测
- 登录界面中透明编辑框的实现(测试平台WINCE 5.0)
- wince下的 类型转换(未完陆续编辑中)
- caffe模型微调时遇到的问题
- VS编辑Excel过程中遇到的问题和记录
- wince MFC程序中F6按键问题解决
- wince 中 按键如何调用一个应用程序
- Linux系统的优化和微调
- 深入浅出Linux操作系统的优化和微调
- 分析和YSlow的微调网站性能
- winCE 怎么实现锁住触摸屏和按键
- 按键驱动中中断的问题
- 第九周项目一
- 黑马程序员--java编程的设计方式
- 重新组织数据之八 :Change Bidirectional Association to Unidirectional(将双向关联改为单向)
- 一道月薪3w的java面试题
- javascript学习实录 之三(对象原型引用prototype) --刘小小尘
- WINCE中微调按键和编辑框的绑定问题
- #define 高级用法
- 几个人围成一圈的问题
- 线程的基本概念、线程的基本状态以及状态之间的关系
- 第9周项目一:Complex 类
- 第九周项目一----实现复数类运算符重载
- 重新组织数据之九 :Replace Magic Number with Symbolic Constant(以符号常量/字面常量取代魔法数)
- Java枚举类型的使用
- 游标是邪恶的!