📄 newweb.cpp
字号:
// newweb.cpp : implementation file
//
#include "stdafx.h"
#include "demo_devstudio.h"
#include "newweb.h"
#include "MainFrm.h"
#include "Workpace.h"
#include "afxdao.h"
#include "Childfrm.h"
#include "demo_devstudioDoc.h"
#include "TreeViewResource.h"
#include "TreeViewFile.h"
#include "rightpaneview.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// Cnewweb dialog
Cnewweb::Cnewweb(CWnd* pParent /*=NULL*/)
: CDialog(Cnewweb::IDD, pParent)
{
//{{AFX_DATA_INIT(Cnewweb)
m_zuoyeming = _T("");
//}}AFX_DATA_INIT
}
void Cnewweb::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Cnewweb)
DDX_Text(pDX, IDC_EDIT1, m_zuoyeming);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(Cnewweb, CDialog)
//{{AFX_MSG_MAP(Cnewweb)
ON_BN_CLICKED(IDC_QUEDING, OnQueding)
ON_BN_CLICKED(IDC_CANCEL, OnCancel)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Cnewweb message handlers
void Cnewweb::OnQueding()
{
// TODO: Add your control notification handler code here
UpdateData(true);
m_zuoyeming.TrimLeft();
m_zuoyeming.TrimRight();
if(m_zuoyeming.IsEmpty())
{
MessageBox("输入作业名无效");
return;
}
CDialog::OnOK();
CDaoDatabase *m_pdatabase;
// CDaoRecordset *m_precordset;
m_pdatabase=new CDaoDatabase;
try
{
m_pdatabase->Create(m_zuoyeming,dbLangGeneral,dbVersion30);
}
catch(CDaoException* e)
{
e->ReportError();
delete m_pdatabase;
m_pdatabase=NULL;
e->Delete();
return;
}
CDaoTableDef td(m_pdatabase);
try
{
td.Create("已知点坐标高程");
td.CreateField("点号",dbText,50);
td.CreateField("x",dbText,50);
td.CreateField("y",dbText,50);
td.CreateField("高程",dbText,50);
td.Append();
td.Close();
td.Create("起始方位角");
td.CreateField("首点",dbText,50);
td.CreateField("末点",dbText,50);
td.CreateField("方位角",dbText,50);
td.Append();
td.Close();
td.Create("水平观测角");
td.CreateField("测站点",dbText,50);
td.CreateField("照准点",dbText,50);
td.CreateField("角度",dbText,50);
td.Append();
td.Close();
td.Create("距离");
td.CreateField("首点",dbText,50);
td.CreateField("末点",dbText,50);
td.CreateField("距离",dbText,50);
td.Append();
td.Close();
td.Create("高差");
td.CreateField("起点",dbText,50);
td.CreateField("末点",dbText,50);
td.CreateField("高差",dbText,50);
td.Append();
td.Close();
td.Create("平差成果");
td.CreateField("点号",dbText,50);
td.CreateField("X",dbText,50);
td.CreateField("Y",dbText,50);
td.CreateField("高程",dbText,50);
td.Append();
td.Close();
td.Create("精度");
td.CreateField("点号",dbText,50);
td.CreateField("长半轴",dbText,50);
td.CreateField("短半轴",dbText,50);
td.CreateField("极大值方向",dbText,50);
td.CreateField("点位中误差",dbText,50);
td.Append();
td.Close();
}
catch(CDaoException *e)
{e->ReportError();
e->Delete();
return;
}
CMainFrame *pmainframe;
pmainframe=(CMainFrame*)AfxGetApp()->m_pMainWnd;
AfxGetApp()->m_pDocManager->OnFileNew();
CChildFrame * m_pchildfrm=(CChildFrame*)pmainframe->GetActiveFrame();
m_pchildfrm->MDIMaximize();
CDemo_DevStudioDoc *pDoc;
pDoc=(CDemo_DevStudioDoc*)m_pchildfrm->GetActiveDocument();
pDoc->m_pchildframe=m_pchildfrm;
pDoc->m_workname=m_zuoyeming;
pDoc->m_viewname=1;
CTreeViewResource *p_view1=(CTreeViewResource*)pmainframe->m_wndWorkspace.GetView(0);
HTREEITEM item1;
item1= p_view1->GetTreeCtrl().InsertItem(m_zuoyeming);
pDoc->m_htreeitem=item1;
CTreeViewFile *p_view2=(CTreeViewFile*)pmainframe->m_wndWorkspace.GetView(1);
p_view2->GetTreeCtrl().DeleteAllItems();
p_view2->GetTreeCtrl().InsertItem("输入水平方向观测值");
p_view2->GetTreeCtrl().InsertItem("输入距离");
p_view2->GetTreeCtrl().InsertItem("输入高差");
p_view2->GetTreeCtrl().InsertItem("输入已知点坐标高程");
p_view2->GetTreeCtrl().InsertItem("输入起始方向值");
p_view2->GetTreeCtrl().InsertItem("导线网平差");
p_view2->GetTreeCtrl().InsertItem("水准网平差");
p_view2->GetTreeCtrl().InsertItem("展点略图");
p_view2->GetTreeCtrl().InsertItem("误差椭圆");
p_view2->GetTreeCtrl().InsertItem("平差成果");
pDoc->m_treeitem=item1;
m_pdatabase->Close();
delete m_pdatabase;
// p_view->GetTreeCtrl().InsertItem("测量数据",item1);
}
void Cnewweb::OnCancel()
{
// TODO: Add your control notification handler code here
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -