void CNoteDlg::OnUpper()
{
// TODO: 在此添加命令处理程序代码
//m_Upper.SetWindowTextA(IDC_EDIT1);
CEdit * p=(CEdit*)GetDlgItem(IDC_EDIT1);
CString str;
p->SetFocus();
p->GetWindowTextA(str);
p->SetSel(0,-1);
str.MakeUpper();
p->SetWindowTextA(str);}
如何控制我用鼠标选中的区域进行大写改变啊?
{
// TODO: 在此添加命令处理程序代码
//m_Upper.SetWindowTextA(IDC_EDIT1);
CEdit * p=(CEdit*)GetDlgItem(IDC_EDIT1);
CString str;
p->SetFocus();
p->GetWindowTextA(str);
p->SetSel(0,-1);
str.MakeUpper();
p->SetWindowTextA(str);}
如何控制我用鼠标选中的区域进行大写改变啊?
CEdit * p=(CEdit*)GetDlgItem(IDC_EDIT1);
CString str,str1;
int is,ie;
p->SetFocus(); p->GetWindowTextA(str);
p->GetSel(is,ie);
str1 = str.Mid(is,ie-is);
str1.MakeUpper(); str= str.Mid(0,is)+str1+str.Mid(ie,str.GetLength()); p->SetWindowTextA(str);
输入123abc456
选择abc
执行代码后输出123ABC456注:代码没有进行错误处理,请加校验代码。
{
// TODO: 在此添加命令处理程序代码
//m_Upper.SetWindowTextA(IDC_EDIT1);
CEdit * p=(CEdit*)GetDlgItem(IDC_EDIT1);
CString str;
//p->SetFocus();
p->SetSel(0,-1);
p->GetWindowTextA(str);
str.MakeUpper();
p->SetWindowTextA(str);}
这么写的意思? 那我怎么才能控制选中的区域啊 0,-1 是选中全文啊