Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
6
Добавлен:
01.05.2014
Размер:
2.82 Кб
Скачать
// testMFCView.cpp : implementation of the CtestMFCView class
//

#include "stdafx.h"
#include "testMFC.h"

#include "testMFCDoc.h"
#include "testMFCView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CtestMFCView

IMPLEMENT_DYNCREATE(CtestMFCView, CFormView)

BEGIN_MESSAGE_MAP(CtestMFCView, CFormView)
	ON_WM_CREATE()
	ON_BN_CLICKED(IDC_BUTTON1, &CtestMFCView::OnBnClickedButton1)
END_MESSAGE_MAP()

// CtestMFCView construction/destruction

CtestMFCView::CtestMFCView()
	: CFormView(CtestMFCView::IDD)
{
	// TODO: add construction code here
}

CtestMFCView::~CtestMFCView()
{
}

void CtestMFCView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_RENDERWINDOW, mRendererWindow);
	DDX_Control(pDX, IDC_EDIT4, mLength);
	DDX_Control(pDX, IDC_EDIT8, mOneLength);
	DDX_Control(pDX, IDC_EDIT5, mDeep);
	DDX_Control(pDX, IDC_EDIT1, mFirstColor);
	DDX_Control(pDX, IDC_EDIT2, mColorStep);
}

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

	return CFormView::PreCreateWindow(cs);
}

void CtestMFCView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();

	mOneLength.SetWindowText(CString("0."));
	mLength.SetWindowText(CString("5"));
	mDeep.SetWindowText(CString("5"));

	mColorStep.SetWindowText(CString("100"));
	mFirstColor.SetWindowText(CString("0"));

	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();

}


// CtestMFCView diagnostics

#ifdef _DEBUG
void CtestMFCView::AssertValid() const
{
	CFormView::AssertValid();
}

void CtestMFCView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}

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


// CtestMFCView message handlers

int CtestMFCView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFormView::OnCreate(lpCreateStruct) == -1)
		return -1;

	// TODO:  Add your specialized creation code here

	return 0;
}

void CtestMFCView::OnBnClickedButton1()
{
//	DoDataExchange()
	CString strA, strDeep, strFirstColor, strColorStep;

	mLength.GetWindowText(strA);
	mDeep.GetWindowText(strDeep);
	mFirstColor.GetWindowText(strFirstColor);
	mColorStep.GetWindowText(strColorStep);


	float a = (float)atoi(strA.GetBuffer()) / pow(10.0f, strA.GetLength());
	unsigned int deep = atoi(strDeep.GetBuffer());
	unsigned int firstColor = atoi(strFirstColor.GetBuffer());
	unsigned int colorStep = atoi(strColorStep.GetBuffer());

	// TODO: Add your control notification handler code here
	mRendererWindow.generateBox(deep, 0, 0, a, firstColor, colorStep );
}


Соседние файлы в папке testMFC