www.pudn.com > TabClient.rar > TabClientView.cpp


// TabClientView.cpp : implementation of the CTabClientView class 
// 
 
#include "stdafx.h" 
#include "TabClient.h" 
 
#include "TabClientDoc.h" 
#include "TabClientView.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CTabClientView 
 
IMPLEMENT_DYNCREATE(CTabClientView, CFormView) 
 
BEGIN_MESSAGE_MAP(CTabClientView, CFormView) 
	//{{AFX_MSG_MAP(CTabClientView) 
	ON_WM_CTLCOLOR() 
	//}}AFX_MSG_MAP 
	// Standard printing commands 
	ON_NOTIFY(FTN_TABCHANGED, IDC_FOLDERTAB, OnChangedTab) 
	ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint) 
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint) 
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview) 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CTabClientView construction/destruction 
 
CTabClientView::CTabClientView() 
	: CFormView(CTabClientView::IDD) 
{ 
	//{{AFX_DATA_INIT(CTabClientView) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
	// TODO: add construction code here 
 
} 
 
CTabClientView::~CTabClientView() 
{ 
} 
 
void CTabClientView::DoDataExchange(CDataExchange* pDX) 
{ 
	CFormView::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CTabClientView) 
	DDX_Control(pDX, IDC_RUSLT, m_wndStaticInfo); 
	//}}AFX_DATA_MAP 
} 
 
BOOL CTabClientView::PreCreateWindow(CREATESTRUCT& cs) 
{ 
	// TODO: Modify the Window class or styles here by modifying 
	//  the CREATESTRUCT cs 
 
	return CFormView::PreCreateWindow(cs); 
} 
 
void CTabClientView::OnInitialUpdate() 
{ 
	CFormView::OnInitialUpdate(); 
	GetParentFrame()->RecalcLayout(); 
	ResizeParentToFit(); 
 
	m_FolderTabCtrl.CreateFromStatic(IDC_FOLDERTAB, this,RGB(255,255,255)); 
	m_FolderTabCtrl.Load(IDR_FOLDERTABS); 
 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CTabClientView printing 
 
BOOL CTabClientView::OnPreparePrinting(CPrintInfo* pInfo) 
{ 
	// default preparation 
	return DoPreparePrinting(pInfo); 
} 
 
void CTabClientView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) 
{ 
	// TODO: add extra initialization before printing 
} 
 
void CTabClientView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) 
{ 
	// TODO: add cleanup after printing 
} 
 
void CTabClientView::OnPrint(CDC* pDC, CPrintInfo* /*pInfo*/) 
{ 
	// TODO: add customized printing code here 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CTabClientView diagnostics 
 
#ifdef _DEBUG 
void CTabClientView::AssertValid() const 
{ 
	CFormView::AssertValid(); 
} 
 
void CTabClientView::Dump(CDumpContext& dc) const 
{ 
	CFormView::Dump(dc); 
} 
 
CTabClientDoc* CTabClientView::GetDocument() // non-debug version is inline 
{ 
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTabClientDoc))); 
	return (CTabClientDoc*)m_pDocument; 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CTabClientView message handlers 
 
HBRUSH CTabClientView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)  
{ 
	HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor); 
	 
	// TODO: Change any attributes of the DC here 
	/*CPen blackPen(PS_SOLID, 1, RGB(0,0,0)); 
	CDC* dc=GetDC(); 
	dc->SelectObject(&blackPen); 
	dc->MoveTo(3,281); 
	dc->LineTo(3,3); 
	dc->LineTo(475,3); 
	dc->LineTo(475,281); 
	dc->LineTo(441,281); 
 
	if(nCtlColor==CTLCOLOR_DLG|nCtlColor==CTLCOLOR_STATIC) 
	{ 
		pDC->SetTextColor(RGB(255,0,0)); 
		pDC->SetBkColor(RGB(160,180,220)); 
		HBRUSH b=CreateSolidBrush(RGB(160,180,220)); 
		return b; 
	} 
*/ 
	// TODO: Return a different brush if the default is not desired 
	return hbr; 
} 
 
void CTabClientView::OnChangedTab(NMFOLDERTAB* nmtab, LRESULT* pRes) 
{ 
	CString s; 
	s.Format(_T("Ñ¡ÖÐ %d: %s"), nmtab->iItem, 
		nmtab->pItem->GetText()); 
	m_wndStaticInfo.SetWindowText(s);	 
}