www.pudn.com > roll.rar > BGRIDWND.CPP
// BgridWnd.cpp : implementation file // #include "stdafx.h" #include "roll.h" #include "geomwnd.h" #include "figure.h" #include "bgridWnd.h" #include "bbroll.h" #include#ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CBgridWnd CBgridWnd::CBgridWnd(CString filename) { m_pFigure = new CFigure(filename); } CBgridWnd::~CBgridWnd() { delete m_pFigure; } BEGIN_MESSAGE_MAP(CBgridWnd, CWnd) //{{AFX_MSG_MAP(CBgridWnd) ON_WM_PAINT() ON_WM_CREATE() ON_WM_DESTROY() ON_WM_SIZE() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CBgridWnd message handlers BOOL CBgridWnd::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) { return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext); } void CBgridWnd::OnPaint() { CPaintDC dc(this); // device context for painting } int CBgridWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CWnd::OnCreate(lpCreateStruct) == -1) return -1; m_pFigure->Create(strGeomWndClass,"GRID",WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,10); return 0; } void CBgridWnd::OnDestroy() { CWnd::OnDestroy(); } void CBgridWnd::OnSize(UINT nType, int cx, int cy) { CWnd::OnSize(nType, cx, cy); m_pFigure->MoveWindow(CRect(0,0,cx,cy),TRUE); }