4. Horizontal scroll
5. Auto HScroll
6. Vertical scroll
7. Auto VScroll
8 .Password
9. No hide selection
10. OEM convert
对用户输入内容进行从Windows字符集到OEM字符集的转化,这样可以使调用AnsiToOem时正常工作。默认不被选中。
11.Want return
12. Border
为控件创建边界,该选项默认被选中。
13. Uppercase
将所有的输入内容转化为大写字符,默认不被选中。
14. Lowercase
将所有的输入内容转化为小写字符,默认不被选中。
15. Read-only
编程实例:Exam6_1编写一个用户登录的应用程序,应用程序维护着一张合法用户的用户名和密码的列表,至于合法用户才能通过登录程序.要求如下:
(1)用户名输入后,转换为大写字母显示,最大长度不能超过10位。
(2)密码以‘*’代替显示,密码只能是6位数字。
(3)按“确定”按钮时,需要确认输入框不为空,且输入符合要求,否则返回输入框重新输入。
(4)对合法用户显示欢迎对话框,对不合法用户显示警告对话框。
相关参考函数代码:
void CExam6_01Dlg::OnOK()
{
// TODO: Add extra validation here
UpdateData(true);
if(m_user.IsEmpty())
{
AfxMessageBox("用户名不能为空,请重新输入");
m_EditUser.SetFocus();
}
else if(m_pwd.IsEmpty())
{
AfxMessageBox("密码不能为空,请重新输入");
m_EditPwd.SetFocus();
}
else
{
int len=m_EditPwd.LineLength();
if(len!=6)
{
AfxMessageBox("密码必须为六位,请重新输入");
m_EditPwd.SetFocus();
}
else
{
for(int i=0;i<5;i++)
if((m_user==userlist[i][0])&&(m_pwd==userlist[i][1]))
{
MessageBox("You are welcome!");
break;
}
if(i==5)
MessageBox("Sorry,you are not permitted.");
}
}
CDialog::OnOK();
}
CExam6_01Dlg::CExam6_01Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CExam6_01Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CExam6_01Dlg)
m_user = _T("");
m_pwd = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
userlist[0][0]="MARY";
userlist[0][1]="123456";
userlist[1][0]="MARY";
userlist[1][1]="123456";
userlist[2][0]="MARY";
userlist[2][1]="123456";
userlist[3][0]="MARY";
userlist[3][1]="123456";
userlist[4][0]="MARY";
userlist[4][1]="123456";
userlist[5][0]="MARY";
userlist[5][1]="123456";
}
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/jisuanjixue/article-27966-5.html
一分钱没有
美国提供的只有战争
直接撞沉
狠狠打击美国在全世界的利益