📄 bianjiview.cpp
字号:
// BianJiView.cpp : implementation file
//
#include "stdafx.h"
#include "demo_devstudio.h"
#include "BianJiView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBianJiView
IMPLEMENT_DYNCREATE(CBianJiView, CFormView)
CBianJiView::CBianJiView()
: CFormView(CBianJiView::IDD)
{
//{{AFX_DATA_INIT(CBianJiView)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_pGridCtrl=NULL;
}
CBianJiView::~CBianJiView()
{
if(m_pGridCtrl)
delete m_pGridCtrl;
}
void CBianJiView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBianJiView)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBianJiView, CFormView)
//{{AFX_MSG_MAP(CBianJiView)
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBianJiView diagnostics
#ifdef _DEBUG
void CBianJiView::AssertValid() const
{
CFormView::AssertValid();
}
void CBianJiView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CBianJiView message handlers
void CBianJiView::OnInitialUpdate()
{
// TODO: Add your specialized code here and/or call the base class
if(m_pGridCtrl==NULL)
{m_pGridCtrl=new CGridCtrl;
if(m_pGridCtrl==NULL)
{MessageBox("创建表格失败");
return;
}
CRect rect;
GetClientRect(rect);
m_pGridCtrl->Create(rect,this,100,WS_BORDER);
m_pGridCtrl->ShowWindow(3);
m_pGridCtrl->SetFixedColumnCount(0);
m_pGridCtrl->SetFixedRowCount(1);
m_pGridCtrl->SetColumnCount(3);
m_pGridCtrl->SetRowCount(10);
m_pGridCtrl->SetColumnWidth(2,120);
m_pGridCtrl->SetColumnWidth(1,100);
m_pGridCtrl->SetColumnWidth(2,100);
static char* xiangmu[]={"测站点","照准点","角度"};
for(int s=0;s<m_pGridCtrl->GetColumnCount();s++)
m_pGridCtrl->SetItemText(0,s,xiangmu[s]);
}
CFormView::OnInitialUpdate();
}
void CBianJiView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
if(m_pGridCtrl->GetSafeHwnd())
{CRect rect;
GetClientRect(rect);
m_pGridCtrl->MoveWindow(rect);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -