www.gusucode.com > 基于VC编程界面编程高级应用技术源码程序 > VC界面编程高级应用技术/code/1/MyExplorer/Right.cpp

    // Right.cpp : implementation file
//

#include "stdafx.h"
#include "MyExplorer.h"
#include "Right.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CRight

IMPLEMENT_DYNCREATE(CRight, CView)

CRight::CRight()
{
}

CRight::~CRight()
{
}


BEGIN_MESSAGE_MAP(CRight, CView)
	//{{AFX_MSG_MAP(CRight)
	ON_WM_CREATE()
	ON_WM_SIZE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CRight drawing

void CRight::OnDraw(CDC* pDC)
{
	CDocument* pDoc = GetDocument();
	// TODO: add draw code here
}

/////////////////////////////////////////////////////////////////////////////
// CRight diagnostics

#ifdef _DEBUG
void CRight::AssertValid() const
{
	CView::AssertValid();
}

void CRight::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CRight message handlers

int CRight::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	//建立m_ShellList
	if (!m_ShellList.Create(WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN 
		| LVS_REPORT | LVS_SHAREIMAGELISTS | LVS_EDITLABELS,
		CRect(0,0,0,0), this, IDC_LISTCTRL))
	{
		TRACE0("Failed to create list control.\n");
		return -1;
	}
	
	m_ShellList.BuildDefaultColumns();
	m_ShellList.SubclassHeader(1);
	return 0;
}

void CRight::OnSize(UINT nType, int cx, int cy) 
{
	CView::OnSize(nType, cx, cy);
	m_ShellList.MoveWindow(0,0,cx,cy);	
}