📄 phonedlg.cpp
字号:
// PhoneDlg.cpp : implementation file
//
#include "stdafx.h"
#include "MsgSend.h"
#include "PhoneDlg.h"
#include "AddPhoneDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPhoneDlg dialog
CPhoneDlg::CPhoneDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPhoneDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPhoneDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CPhoneDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPhoneDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPhoneDlg, CDialog)
//{{AFX_MSG_MAP(CPhoneDlg)
ON_BN_CLICKED(IDC_ADD, OnAdd)
ON_BN_CLICKED(IDC_MODIFY, OnModify)
ON_BN_CLICKED(IDC_DELETE, OnDelete)
ON_BN_CLICKED(IDC_SELECTALL, OnSelectall)
ON_BN_CLICKED(IDC_NOSELECTALL, OnNoselectall)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPhoneDlg message handlers
BOOL CPhoneDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_List.Create(CRect(0,0,160,320),this,1101,IDB_CHECK,IDB_UNCHECK,IDB_DISENBLE,RGB(214,215,206));
for(int i=0;i<m_pArrPhone->GetSize();i++)
m_List.AddString(m_pArrPhone->GetAt(i));
m_bModify=FALSE;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPhoneDlg::OnAdd()
{
// TODO: Add your control notification handler code here
CAddPhoneDlg dlg;
if(dlg.DoModal()==IDOK)
{
m_pArrPhone->Add(dlg.m_strPhone);
m_List.AddString(dlg.m_strPhone);
m_bModify=TRUE;
}
}
void CPhoneDlg::OnModify()
{
// TODO: Add your control notification handler code here
int cul=m_List.GetCurSel();
if(cul==LB_ERR)
{
MessageBox("请选择一个号码!","错误");
return;
}
CAddPhoneDlg dlg;
m_List.GetText(cul,&dlg.m_strPhone);
if(dlg.DoModal()==IDOK)
{
m_List.SetItemText(cul,dlg.m_strPhone);
m_pArrPhone->SetAt(cul,dlg.m_strPhone);
m_bModify=TRUE;
}
}
void CPhoneDlg::OnDelete()
{
// TODO: Add your control notification handler code here
int cul=m_List.GetCurSel();
if(cul==LB_ERR)
{
MessageBox("请选择一个号码!","错误");
return;
}
if(AfxMessageBox("真的要删除吗?",MB_YESNO)==IDNO)return;
m_List.DeleteString(cul);
m_bModify=TRUE;
m_pArrPhone->RemoveAt(cul);
// if(m_List.GetCount)
// m_List.SetCurSel(0);
}
void CPhoneDlg::OnSelectall()
{
// TODO: Add your control notification handler code here
for(int i=0;i<m_List.GetCount();i++)
m_List.SetCheck(i,CHECKED);
}
void CPhoneDlg::OnNoselectall()
{
for(int i=0;i<m_List.GetCount();i++)
m_List.SetCheck(i,UNCHECKED);
}
void CPhoneDlg::OnOK()
{
CString str;
m_retPhoneList="";
for(int i=0;i<m_List.GetCount();i++)
{
if(m_List.GetCheck(i)==CHECKED)
{
m_List.GetText(i,&str);
m_retPhoneList=m_retPhoneList+str+",";
}
}
m_retPhoneList=m_retPhoneList.Left(m_retPhoneList.GetLength()-1);
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -