📄 gridwnd.cpp
字号:
// GridWnd.cpp : implementation file
//
#include "stdafx.h"
#include "matrixcalculator.h"
#include "GridWnd.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CGridWnd
//DEL CGridWnd::CGridWnd()
//DEL {
//DEL }
//DEL CGridWnd::~CGridWnd()
//DEL {
//DEL }
//DEL CGridWnd::CGridWnd(CWnd* pWnd,UINT nRow,UINT nCol)//CGridWnd类构造函数
//DEL { m_pParentWnd=pWnd;//父窗口句柄
//DEL Row=nRow;//行数
//DEL Col=nCol;//列数
//DEL }
//DEL BOOL CGridWnd::Create()//重载Create函数,建立一个与父窗口同样大小的Grid窗口
//DEL {
//DEL RECT rect;
//DEL m_pParentWnd-〉GetClientRect(&&rect);
//DEL return CWnd::Create(NULL, NULL, WS_CHILD|WS_VISIBLE, rect, m_pParentWnd, NULL,NULL);
//DEL }
//BOOL CGridWnd::OnEraseBkgnd(CDC* pDC)//这个函数根据给出的行、列数画出网格
//{
// for(int i=0;i〈Row+1;i++)//变量Row和Col是要创建的表格的行列数
// {
// pDC-〉MoveTo(0,i*24);//网格大小为104×24
// pDC-〉LineTo(Col*104,i*24);
// }
// for(int j=0;j〈Col+1;j++)
// {
// pDC-〉MoveTo(j*104,0);
// pDC-〉LineTo(j*104,Row*24);
//}
// return TRUE;
//}
//DEL int CGridWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)//将单元格放到画好的网格中
//DEL {
//DEL RECT rect;
//DEL for(int i=0;i〈Row;i++)
//DEL for(int j=0;j〈Col;j++)
//DEL {
//DEL Cell[i]=new CCell(); //根据每行、列的网格数生成相应的单元格
//DEL rect.top=i*24+2; //设定每个单元格大小为100×20,并确定单元格所在位置
//DEL rect.left=j*104+2;
//DEL rect.bottom=rect.top+20;
//DEL rect.right=rect.left+100;
//DEL Cell[i]-〉Create(WS_CHILD|WS_VISIBLE,rect,this,0); //在网格中放入单元格
//DEL }
//DEL return 0;
//DEL }
BEGIN_MESSAGE_MAP(CGridWnd, CWnd)
//{{AFX_MSG_MAP(CGridWnd)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGridWnd message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -