您的位置:首页 > 其它

常用控件技巧

2008-07-11 16:58 309 查看
1、跟随鼠标移动的控件:
voidCMy0231Dlg::OnMouseMove(UINTnFlags,CPointpoint)

{

//TODO:Addyourmessagehandlercodehereand/orcalldefault

CRectrc,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、使用回车移动控件焦点

BOOLCMy0231Dlg::PreTranslateMessage(MSG*pMsg)

{

//TODO:Addyourspecializedcodehereand/orcallthebaseclass

if(pMsg->wParam==13)

{

pMsg->wParam=9;

}

returnCDialog::PreTranslateMessage(pMsg);

}

3、设置控件的tab顺序

按下<Ctrl+D>组合键可以对控件的Tab顺序进行编辑。


待续,,,
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: