📄 dlgshapeman.cpp
字号:
// DlgShapeMan.cpp : implementation file
//
#include "stdafx.h"
#include "eboard.h"
//包含的头文件
#include "EboardDoc.h"
#include "Shape.h"
#include "DlgShapeMan.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// DlgShapeMan dialog
DlgShapeMan::DlgShapeMan(CWnd* pParent /*=NULL*/)
: CDialog(DlgShapeMan::IDD, pParent)
{
//{{AFX_DATA_INIT(DlgShapeMan)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void DlgShapeMan::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DlgShapeMan)
DDX_Control(pDX, IDC_SHAPELIST, m_ctrList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(DlgShapeMan, CDialog)
//{{AFX_MSG_MAP(DlgShapeMan)
ON_BN_CLICKED(IDC_SHAPEDEL, OnShapedel)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// DlgShapeMan message handlers
BOOL DlgShapeMan::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
Shape *s=NULL;
int size=m_pDoc->m_co.shapeArray.GetSize();
//遍历图形数组,并将图形数组中的每一个图形结点的表达式加入对话框中的列表框中
for(int i=0;i<size;i++){
s=(Shape *)m_pDoc->m_co.shapeArray.GetAt(i);
m_ctrList.AddString(s->getExpression());
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void DlgShapeMan::OnShapedel() //图形管理对话框中的(按下)擦去键的消息处理函数
{
// TODO: Add your control notification handler code here
int n=m_ctrList.GetCurSel(); //获取列表模框中的当前选中项的下标值
if(n>=0){
if(IDYES==MessageBox("确定要删除选中的图形吗?","询问",MB_ICONINFORMATION | MB_YESNO)){
m_ctrList.DeleteString(n); //删除列表框中选中的项
m_pDoc->m_co.delShape(n); //删除该项对应的图形数组中的图形
m_pDoc->UpdateAllViews(NULL); //刷新视图
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -