如何改变编辑控件的文本? [英] How change edit control's text?

查看:128
本文介绍了如何改变编辑控件的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MFC对话框窗口中的按钮和文本控件,当我点击按钮,在编辑控件必须更换,例如的Hello World。结果
但如果我写

I have a button and text control in MFC dialog window, when I click on button, in edit control must be replaced for example "hello world".
but if I write

edit="hello wordl"

它不会改变,的我该怎么改?

推荐答案

首先,你应该添加一个变量edit.To做的编辑右击并选择添加变量...在添加成员从控制变量向导变化类别为之后,在变量名称字段类型名称,如 m_EditValue 然后单击finish.from现在你可以简单地按照code改变编辑控制。

First you should add a variable to edit.To do that right click on the edit and choose Add Variable... in Add Member variable Wizard change Category from Control to Value after that in the Variable name field type a name like m_EditValue then click finish.from now you can change the Edit Control simply by following code.

   void CAboutDlg::OnBnClickedButton1()
    {
        // TODO: Add your control notification handler code here
        m_EditValue = L"Hello World";
        UpdateData(FALSE);
    }

这篇关于如何改变编辑控件的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆