www.pudn.com > ksqx.rar > KSQXView.cpp


// KSQXView.cpp : implementation of the CKSQXView class 
// 
 
#include "stdafx.h" 
#include "KSQX.h" 
 
#include "KSQXDoc.h" 
#include "KSQXView.h" 
 
#include "ksqxclass.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CKSQXView 
 
IMPLEMENT_DYNCREATE(CKSQXView, CView) 
 
BEGIN_MESSAGE_MAP(CKSQXView, CView) 
	//{{AFX_MSG_MAP(CKSQXView) 
	ON_COMMAND(ID_KSQX_DRAW, OnKsqxDraw) 
	//}}AFX_MSG_MAP 
	// Standard printing commands 
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) 
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) 
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CKSQXView construction/destruction 
 
CKSQXView::CKSQXView() 
{ 
	// TODO: add construction code here 
 
} 
 
CKSQXView::~CKSQXView() 
{ 
} 
 
BOOL CKSQXView::PreCreateWindow(CREATESTRUCT& cs) 
{ 
	// TODO: Modify the Window class or styles here by modifying 
	//  the CREATESTRUCT cs 
 
	return CView::PreCreateWindow(cs); 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CKSQXView drawing 
 
void CKSQXView::OnDraw(CDC* pDC) 
{ 
	CKSQXDoc* pDoc = GetDocument(); 
	ASSERT_VALID(pDoc); 
	// TODO: add draw code for native data here 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CKSQXView printing 
 
BOOL CKSQXView::OnPreparePrinting(CPrintInfo* pInfo) 
{ 
	// default preparation 
	return DoPreparePrinting(pInfo); 
} 
 
void CKSQXView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) 
{ 
	// TODO: add extra initialization before printing 
} 
 
void CKSQXView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) 
{ 
	// TODO: add cleanup after printing 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CKSQXView diagnostics 
 
#ifdef _DEBUG 
void CKSQXView::AssertValid() const 
{ 
	CView::AssertValid(); 
} 
 
void CKSQXView::Dump(CDumpContext& dc) const 
{ 
	CView::Dump(dc); 
} 
 
CKSQXDoc* CKSQXView::GetDocument() // non-debug version is inline 
{ 
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CKSQXDoc))); 
	return (CKSQXDoc*)m_pDocument; 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CKSQXView message handlers 
 
void CKSQXView::OnKsqxDraw()  
{ 
	// TODO: Add your command handler code here 
	KSQXClass myksqx; 
	KSQXPoint p1, p2; 
	p1.m_x = 100; 
	p1.m_y = 300; 
	p2.m_x = 400; 
	p2.m_y = 300; 
	myksqx.SetLimit(1); 
	CDC* pdc; 
	pdc = GetDC(); 
	myksqx.Draw(pdc, p1, p2); 
}