常用控件技巧

来源:互联网 发布:健身房能减肥吗 知乎 编辑:程序博客网 时间:2024/04/28 16:02
1、跟随鼠标移动的控件:
void CMy0231Dlg::OnMouseMove(UINT nFlags, CPoint point) {// TODO: Add your message handler code here and/or call defaultCRect rc,rect;    GetClientRect(&rect);if (rect.PtInRect(point)){m_Edit.GetClientRect(&rc);rc.left=point.x;rc.right=point.x+rc.right;rc.top=point.y;rc.bottom=point.y+rc.bottom;m_Edit.MoveWindow(&rc);}CDialog::OnMouseMove(nFlags, point);}

 

2、使用回车移动控件焦点

BOOL CMy0231Dlg::PreTranslateMessage(MSG* pMsg) {// TODO: Add your specialized code here and/or call the base classif (pMsg->wParam==13){pMsg->wParam=9;}return CDialog::PreTranslateMessage(pMsg);}
3、设置控件的tab顺序
 按下<Ctrl + D>组合键可以对控件的Tab顺序进行编辑。
 
待续,,,
原创粉丝点击