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

📄 testview.cpp

📁 一个简单的心理学测试软件.用C++ MFC编写.
💻 CPP
字号:
// TestView.cpp : implementation of the CTestView class
//

#include "stdafx.h"
#include "Test.h"

#include "TestDoc.h"
#include "TestView.h"
#include "TestSheet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTestView

IMPLEMENT_DYNCREATE(CTestView, CView)

BEGIN_MESSAGE_MAP(CTestView, CView)
	//{{AFX_MSG_MAP(CTestView)
	ON_COMMAND(IDM_PROPERTYSHEET, OnPropertysheet)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTestView construction/destruction

CTestView::CTestView()
{
	// TODO: add construction code here

}

CTestView::~CTestView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CTestView drawing

void CTestView::OnDraw(CDC* pDC)
{
	CTestDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	CFont font;
	font.CreatePointFont(100,"黑体");
    CFont *pOldFont;
	pOldFont=pDC->SelectObject(&font);
    int a;
	CString strTemp0,strTemp2,strTemp3,strTemp4,strTemp1;
	//strTemp0="这是一个小小心理测试软件,测试结果只供参考,信不信由你。";
	strTemp1="你承受压力的心理素质比较差,很容易失去心理平衡,变得窘促不安,甚至惊慌失措。";
    strTemp2="你的心理素质比较强,性情还算比较稳定,遇事一般不会十分惊慌,但有时往往采取消极应付的态度。";
    strTemp3="你的心理素质很好,几乎没有令你感到尴尬的事,尽管偶尔会失去控制,但惫自来说,你的应变能力很强,是一个能经常保持镇静,从容不迫的人。";
    strTemp4="这是一个小小心理测试软件,测试结果只供参考,信不信由你。";
	switch(m_q1)
	{
	case 0:
	    a=0; 
		break;
	case 1:
		a=5;
		break;
	case 2:
		a=2;
		break;
	default:
		break;
	}
	switch(m_q2)
	{
	case 0:
	
		break;
	case 1:
		a=a+5;
		break;
	case 2:
		a=a+2;
		break;
	default:
		break;
	}
	switch(m_q3)
	{
	case 0:
	
		break;
	case 1:
		a=a+5;
		break;
	case 2:
		a=a+2;
		break;
	default:
		break;
	}
	switch(m_q4)
	{
	case 0:
	
		break;
	case 1:
		a=a+5;
		break;
	case 2:
		a=a+2;
		break;
	default:
		break;
	}
	switch(m_q5)
	{
	case 0:
	
		break;
	case 1:
		a=a+5;
		break;
	case 2:
		a=a+2;
		break;
	default:
		break;
	}
    switch(m_q6)
	{
	case 0:

		break;
	case 1:
		a=a+5;
		break;
	case 2:
		a=a+2;
		break;
	default:
		break;
	}
	switch(m_q7)
	{
	case 0:

		break;
	case 1:
		a=a+5;
		break;
	case 2:
		a=a+2;
		break;
	default:
		break;
	}
	switch(m_q8)
	{
	case 0:

		break;
	case 1:
		a=a+5;
		break;
	case 2:
		a=a+2;
		break;
	default:
		break;
	}
  //  if(a==0)pDC->TextOut(0,0,strTemp0);
    if(a>=0&&a<25)pDC->TextOut(0,200,strTemp1);
	else if(a>=25&&a<32)pDC->TextOut(0,200,strTemp2);
	else if(a>=32&&a<=40)pDC->TextOut(0,200,strTemp3);
    else pDC->TextOut(0,200,strTemp4);
    pDC->SelectObject(pOldFont);

}

/////////////////////////////////////////////////////////////////////////////
// CTestView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CTestView message handlers

void CTestView::OnPropertysheet() 
{
	// TODO: Add your command handler code here
	CTestSheet testSheet("心理测试程序");
    testSheet.SetWizardMode();
//	testSheet.DoModal();
	if(ID_WIZFINISH==testSheet.DoModal())
	{
	m_q1=testSheet.m_prop1.m_question1;
	m_q2=testSheet.m_prop1.m_question2;
	m_q3=testSheet.m_prop2.m_question3;
	m_q4=testSheet.m_prop2.m_question4;
	m_q5=testSheet.m_prop3.m_question5;
	m_q6=testSheet.m_prop3.m_question6;
	m_q7=testSheet.m_prop4.m_question7;
	m_q8=testSheet.m_prop4.m_question8;
	Invalidate(); //让窗口无效
	
	}
}

⌨️ 快捷键说明

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