16,550
社区成员
发帖
与我相关
我的任务
分享
void CMdiInDlgDlg::OnUpdateEdit1()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_UPDATE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
CString oldStr=m_Edit;
UpdateData(TRUE);
if(m_Edit==oldStr)
return;
// afxDump << m_Edit << "\n";
int col,row;
CString str;
CButton *pUnchk=0;
oldStr="";
for(row=0;row<m_row;row++)
{
for(col=0;col<m_col;col++)
{
CButton *p=(CButton*)GetDlgItem((2000+row*m_col+col));
if(p->GetCheck()==1)
{
GetDlgItem((2000+row*m_col+col))->GetWindowText(str);
if(m_Edit.Find(str)>=0)
{
oldStr += str;
}
else
{
pUnchk = p;
}
}
}
}
if(pUnchk) pUnchk->SetCheck(0);
m_Edit=oldStr;
UpdateData(FALSE);
}
只要 edit “(x,y)” 里有一个 字符被 删除 button 就 uncheck 。 
void CMdiInDlgDlg::OnCheckButton(UINT nID)
{// key pressed
// TODO: Add your command handler code here
int col,row;
CString str;
m_Edit="";
for(row=0;row<m_row;row++)
{
for(col=0;col<m_col;col++)
{
CButton *p=(CButton*)GetDlgItem((2000+row*m_col+col));
if(p->GetCheck()==1)
{
GetDlgItem((2000+row*m_col+col))->GetWindowText(str);
m_Edit += str;
}
}
}
UpdateData(FALSE);
}
“还有怎么删除编辑框中的坐标来是选中的复选框变为不选中”
Edit Update 时 检查 edit的内容,
BOOL CMdiInDlgDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
int x,y;
int row,col;
m_row=3;
m_col=3;
m_pMyChk=new CButton[m_row*3+m_col];
for(row=0;row<3;row++)
{
y = 30+ 40*row;
for(col=0;col<3;col++)
{
x = 20+150*col;
CRect rect;// not (x,y,50,50); !!!!
rect.left=x;
rect.top=y;
rect.right=rect.left+100;
rect.bottom=rect.top+50;
// afxDump << rect << "\n";
m_pMyChk[row*3+col].Create("(4.1)",WS_TABSTOP|WS_VISIBLE|WS_CHILD|BS_AUTOCHECKBOX,rect,this,(col+100)*(row+100));
}
}
以后 再创建 要
m_pMyChk[jj].DestryWindow();
delete [] m_pMyChk
然后 再 create
还有怎么把勾选的复选框后面的坐标显示在编辑框中