标签:
下面的程序实现:
(1)按下键盘左键减少数值并用控件显示
(2)按下键盘右键增加数值并用控件显示
其中的刷新就用到了局部刷新,只刷新显示数字的控件
BOOL CEditTestDlg::PreTranslateMessage(MSG* pMsg) { if (pMsg->message == WM_KEYDOWN) { if (pMsg->wParam == VK_RIGHT) { tmp++; m_value.Format(_T("%d"),tmp); GetDlgItem(IDC_EDIT1)->SetWindowText(m_value); return TRUE; } if (pMsg->wParam == VK_LEFT) { tmp--; m_value.Format(_T("%d"),tmp); GetDlgItem(IDC_EDIT1)->SetWindowText(m_value); return TRUE; } } return CDialog::PreTranslateMessage(pMsg); }
参考:http://www.cnblogs.com/skywatcher/p/3750059.html
标签:
原文地址:http://blog.csdn.net/calmreason/article/details/42461169