描述:
代码如下,可是调试运行就出错
// MainFrm.h: interface for the CMainFrame class.
#ifndef MAINFRM_H
#define MAINFRM_H
#include "_usergrid.h"
class CMainFrame : public CFrameWnd {
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnSize(UINT nType, int cx, int cy);
protected:
C_UserGrid m_grid;
//CEdit m_editTxt;
DECLARE_DYNAMIC(CMainFrame)
DECLARE_MESSAGE_MAP()
};
#endif
// MainFrm.cpp: implementation of the CMainFrame class.
#include "stdafx.h"
#include "MainFrm.h"
#define IDC_EDIT1 1
IMPLEMENT_DYNAMIC(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_WM_CREATE()
ON_WM_SIZE()
ON_WM_SETFOCUS()
END_MESSAGE_MAP()
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (! m_grid.Create("SNGrid", WS_CHILD, rectDefault, this, IDC_EDIT1))
return -1;
m_grid.ShowWindow(SW_NORMAL);
m_grid.UpdateWindow();
return 0;
}
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
RECT rect;
GetClientRect(&rect);
m_grid.MoveWindow(&rect);
}
void CMainFrame::OnSetFocus(CWnd *pOldWnd)
{
m_grid.SetFocus();
}