首页 > 其他 > 详细

MFC编辑框的使用

时间:2014-03-04 22:01:20      阅读:643      评论:0      收藏:0      [点我收藏+]

编辑框的提取

1.在void CDialogDlg::OnChangeEdit1()

bubuko.com,布布扣
void CDialogDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CDialogDlg)
        // NOTE: the ClassWizard will add DDX and DDV calls here
    //}}AFX_DATA_MAP

    DDX_CBString(pDX,IDC_EDIT1,m_edite1);
}
bubuko.com,布布扣

2.在此编辑框的消息响应函数中读取

bubuko.com,布布扣
void CDialogDlg::OnChangeEdit1() 
{
    // TODO: If this is a RICHEDIT control, the control will not
    // 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
    //获取编辑框内容方式1 
//        GetDlgItem(IDC_EDIT1)->GetWindowText(m_edite1);   
    //获取编辑框内容方式2
//    GetDlgItemText(IDC_EDIT1,m_edite1);
}
bubuko.com,布布扣

2.如何给编辑框关联变量,如何让编辑框显示文本

bubuko.com,布布扣
//获得EDIT

CEdit* pBoxOne;

pBoxOne = (CEdit*) GetDlgItem(IDC_EDIT1);

//付值

pBoxOne->SetWindowText( _T"FOO" );

//取值

CString str;

pBoxOne->GetWindowText(str);

GetDlgItem(IDC_EDIT1)->SetWindowText( _T"FOO" );

也可以

//取值

CString str;

GetDlgItem(IDC_EDIT1)->GetWindowText(str);
bubuko.com,布布扣

MFC编辑框的使用,布布扣,bubuko.com

MFC编辑框的使用

原文:http://www.cnblogs.com/yuqilihualuo/p/3579797.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!