One, the static text editor Edit Control-online lesson notes

One, the static text editor Edit Control

The first small control case (not complete)
can get or modify the value of the control directly through the ID of the control through GetDlgItemText (control id, variable that receives data) and SetDlgItemText (control id, variable with data)

Edit Control:

  1. Attributes
    1. Horizontal Scroll: Horizontal scroll bar
    2. Vertical Scroll: vertical scroll bar
    3. want return: whether to accept carriage returns
    4. ···
      Insert picture description here
void Cmfc011105Dlg::OnBnClickedButtonCount()
{
	// TODO: 在此添加控件通知处理程序代码
	//统计文本框中输入的字符的个数
	CString strLength;
	GetDlgItemText(IDC_EDIT_INPUT,strLength);
	int n = strLength.GetLength();

	CString strOutput;
	strOutput.Format(_T("字符串长度为:%d, 字符个数为:%d"), n, n);
	SetDlgItemText(IDC_STATIC_OUTPUT,strOutput);
}

Guess you like

Origin blog.csdn.net/weixin_49035356/article/details/109530316