⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmypxview.cpp

📁 对话框实现读入文件
💻 CPP
字号:
// CmyPXView.cpp : implementation of the CCmyPXView class
//

#include "stdafx.h"
#include "CmyPX.h"

#include "CmyPXDoc.h"
#include "CmyPXView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCmyPXView

IMPLEMENT_DYNCREATE(CCmyPXView, CView)

BEGIN_MESSAGE_MAP(CCmyPXView, CView)
	//{{AFX_MSG_MAP(CCmyPXView)
	ON_COMMAND(ID_PX, OnPx)
	ON_WM_CANCELMODE()
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CCmyPXView construction/destruction

CCmyPXView::CCmyPXView()
{
	// TODO: add construction code here
	bdraw = FALSE;
}

CCmyPXView::~CCmyPXView()
{
}

BOOL CCmyPXView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CCmyPXView drawing

void CCmyPXView::OnDraw(CDC* pDC)
{
	CCmyPXDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	if (bdraw == TRUE)
	{
		CClientDC dc(this);
		COLORREF color=RGB(255,0,0);
		dc.SetTextColor(color);
		dc.TextOut(250,100,"★★★排序前的数据★★★");
		color=RGB(0,0,255);
		dc.SetTextColor(color);
		dc.TextOut(250,300,"★★★排序后的数据★★★");		
		CString str,str1;
		str.Format("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d", 
			Px.m_nIn[0], Px.m_nIn[1], Px.m_nIn[2], Px.m_nIn[3], Px.m_nIn[4], Px.m_nIn[5]
			, Px.m_nIn[6], Px.m_nIn[7], Px.m_nIn[8], Px.m_nIn[9]);
		color=RGB(255,0,0);
		dc.SetTextColor(color);
		dc.TextOut(250,150,str);
		str1.Format("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d", 
			Px.m_nOut[0], Px.m_nOut[1], Px.m_nOut[2], Px.m_nOut[3], Px.m_nOut[4], Px.m_nOut[5]
			, Px.m_nOut[6], Px.m_nOut[7], Px.m_nOut[8], Px.m_nOut[9]);
		color=RGB(0,0,255);
		dc.SetTextColor(color);
		dc.TextOut(250,350,str1);

	}
}

/////////////////////////////////////////////////////////////////////////////
// CCmyPXView printing

BOOL CCmyPXView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CCmyPXView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CCmyPXView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CCmyPXView diagnostics

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

void CCmyPXView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CCmyPXDoc* CCmyPXView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCmyPXDoc)));
	return (CCmyPXDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CCmyPXView message handlers

void CCmyPXView::OnPx() 
{
	// TODO: Add your command handler code here
	if(Px.DoModal() == IDOK)
	{
		switch(Px.m_nMethod)
		{
		case 0:
			Px.Method1();
			break;
		case 1:
			Px.Method2();
			break;
		case 2:
			Px.Method3();
			break;
		case 3:
			Px.Method4();
			break;
		default:
			break;
		}
		bdraw = TRUE;
		UpdateData();
	}
}

void CCmyPXView::OnCancelMode() 
{
	CView::OnCancelMode();
	
	// TODO: Add your message handler code here
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -