CEdit 密码输入框实现
1.密码输入
在::OnInitDialog()函数中添加代码如下
TCHAR ch = '*';
((CEdit *)GetDlgItem(IDC_EDIT_PASSWORD))->SetPasswordChar(ch);
添加一个按钮来点击显示输入的密码
按钮消息函数::OnBnClickedButton_ShowPassword()
GetDlgItem(IDC_EDIT_PASSWORD)->GetWindowText(m_Password);
AfxMessageBox(m_Password);
2.单选按钮
在::OnInitDialog()函数中添加代码如下
CheckRadioButton(IDC_RADIO1,IDC_RADIO3,IDC_RADIO2);
添加一个按钮来点击显示选中的单选按钮
按钮消息函数::OnBnClickedButton_ShowPassword()
CString str;
UINT nID = GetCheckedRadioButton(IDC_RADIO1,IDC_RADIO3);
GetDlgItemText(nID,str);AfxMessageBox(str);
效果如下:
转载于:https://my.oschina.net/mjRao/blog/88319