How change edit control#39;s text?(如何更改编辑控件的文本?)
问题描述
我在 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"
它没有改变,我该如何改变?
推荐答案
首先您应该添加一个要编辑的变量.要做到这一点,请右键单击编辑并在 Add Member variable Wizard<中选择 Add Variable.../code> 将类别从
Control
更改为 Value
之后,在变量名称字段中键入一个名称,如 m_EditValue
然后单击完成.从现在您可以只需通过以下代码更改编辑控件.
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);
}
这篇关于如何更改编辑控件的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何更改编辑控件的文本?


基础教程推荐
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- 为什么语句不能出现在命名空间范围内? 2021-01-01
- 从 std::cin 读取密码 2021-01-01
- 使用从字符串中提取的参数调用函数 2022-01-01
- Windows Media Foundation 录制音频 2021-01-01
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01