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

📄 program2dlg.cpp

📁 基于vc环境开发的主成分分析软件
💻 CPP
📖 第 1 页 / 共 3 页
字号:
// ProGram2Dlg.cpp : implementation file
//

#include "stdafx.h"
#include "ProGram2.h"
#include "ProGram2Dlg.h"
#include "CSpreadSheet.h"//控制Excel数据读写
#include "Matrix.h"
#include "afx.h"
/*放进了.h文件中///////////////////////////////
//#include "AFXDB.H"
//#include "ODBCINST.H"
//#include "float.h"//运用atof
//#include "Afxdlgs.h"//控制打开保存对话框
//#include "CSpreadSheet.h"//控制Excel数据读写
//#include "ResultDlg.h"
//#include "Factor.h"
//#include "AMoment.h"
*/
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About//////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	CWBButton m_IDOK;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	public:
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	virtual BOOL OnInitDialog();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	DDX_Control(pDX, IDOK, m_IDOK);
	//}}AFX_DATA_MAP
}
BOOL CAboutDlg::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) 
{
	// TODO: Add your specialized code here and/or call the base class

	return CDialog::Create(IDD, pParentWnd);
}

BOOL CAboutDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_IDOK.LoadBitmaps(IDB_BITMAP1,5, 5, 5, 5, 4 );
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// FactorsData dialog

class FactorsData : public CDialog
{
// Construction
public:
	FactorsData(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
	//{{AFX_DATA(FactorsData)
	enum { IDD = IDD_Factors };
	int m_MeanRows;///////////
	int m_MeanCols;///////////////添加
	double m_OfferRate;////////////
	BOOL m_CHECK1;
	BOOL m_CHECK2;
	BOOL m_CHECK3;
	BOOL m_CHECK4;
	//}}AFX_DATA

	CWBButton m_Cancel;
	CWBButton	m_OK;
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(FactorsData)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(FactorsData)
	virtual BOOL OnInitDialog();
	afx_msg void OnUpdateOfferRate();
		// NOTE: the ClassWizard will add member functions here
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};
FactorsData::FactorsData(CWnd* pParent /*=NULL*/)
	: CDialog(FactorsData::IDD, pParent)
{
	//{{AFX_DATA_INIT(FactorsData)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void FactorsData::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(FactorsData)
	DDX_Control(pDX, IDCANCEL, m_Cancel);
	DDX_Control(pDX, IDOK, m_OK);
	DDX_Text(pDX, IDC_MeanRows, m_MeanRows);//////////////
	DDX_Text(pDX, IDC_MeanCols, m_MeanCols);//////////////添加
	DDX_Text(pDX, IDC_OfferRate, m_OfferRate);//////////////
	DDX_Check(pDX, IDC_CHECK1, m_CHECK1);
	DDX_Check(pDX, IDC_CHECK2, m_CHECK2);
	DDX_Check(pDX, IDC_CHECK3, m_CHECK3);
	DDX_Check(pDX, IDC_CHECK4, m_CHECK4);
	//}}AFX_DATA_MAP
}
BOOL FactorsData::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_OK.LoadBitmaps(IDB_BITMAP1,5, 5, 5, 5, 4 );
	m_Cancel.LoadBitmaps(IDB_BITMAP1,5, 5, 5, 5, 4 );
	m_CHECK1=0;
	m_CHECK2=0;
	m_CHECK3=0;
	m_CHECK4=0;
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
void FactorsData::OnUpdateOfferRate()
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_UPDATE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(true);
	if(m_OfferRate>1 ||m_OfferRate<0)
	{
		MessageBox("    无效的累积贡献率     ","出错啦");
		m_OfferRate=0.8;
	}
	UpdateData(false);

}

BEGIN_MESSAGE_MAP(FactorsData, CDialog)
	//{{AFX_MSG_MAP(FactorsData)
	ON_EN_UPDATE(IDC_OfferRate, OnUpdateOfferRate)
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// MainFactorsData dialog
class MainFactorsData : public CDialog
{
// Construction
public:
	MainFactorsData(CWnd* pParent = NULL);   // standard constructor
// Dialog Data
	//{{AFX_DATA(MainFactorsData)
	enum { IDD = IDD_MainFactors };
	CWBButton	m_OK;
	CWBButton	m_Cancel;
	int m_MeanRows;///////////
	int m_MeanCols;///////////////添加
	double m_OfferRate;////////////
	int m_ModoKind;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(MainFactorsData)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(MainFactorsData)
	virtual BOOL OnInitDialog();
	afx_msg void OnUpdateOfferRate();
	afx_msg void OnRadio1();
	afx_msg void OnRadio2();
		// NOTE: the ClassWizard will add member functions here
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};
MainFactorsData::MainFactorsData(CWnd* pParent /*=NULL*/)
	: CDialog(MainFactorsData::IDD, pParent)
{
	//{{AFX_DATA_INIT(MainFactorsData)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void MainFactorsData::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(MainFactorsData)
	DDX_Control(pDX, IDOK, m_OK);
	DDX_Control(pDX, IDCANCEL, m_Cancel);
	DDX_Text(pDX, IDC_MeanRows, m_MeanRows);//////////////
	DDX_Text(pDX, IDC_MeanCols, m_MeanCols);//////////////添加
	DDX_Text(pDX, IDC_OfferRate, m_OfferRate);//////////////
	//}}AFX_DATA_MAP
}
BOOL MainFactorsData::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_OK.LoadBitmaps(IDB_BITMAP1,5, 5, 5, 5, 4 );
	m_Cancel.LoadBitmaps(IDB_BITMAP1,5, 5, 5, 5, 4 );
	m_ModoKind=2;
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
void MainFactorsData::OnUpdateOfferRate()
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_UPDATE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(true);
	if(m_OfferRate>1 ||m_OfferRate<0)
	{
		MessageBox("    无效的累积贡献率    ","出错啦");
		m_OfferRate=0.8;
	}
	UpdateData(false);

}
void MainFactorsData::OnRadio1()
{
	m_ModoKind=0;
}
void MainFactorsData::OnRadio2()
{
	m_ModoKind=1;
}
BEGIN_MESSAGE_MAP(MainFactorsData, CDialog)
	//{{AFX_MSG_MAP(MainFactorsData)
	ON_EN_UPDATE(IDC_OfferRate, OnUpdateOfferRate)
	ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
	ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// ONorINData dialog

class ONorINData : public CDialog
{
// Construction
public:
	ONorINData(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
	//{{AFX_DATA(ONorINData)
	enum { IDD = IDD_ONorIN };
	CWBButton	m_OK;
	CWBButton	m_Cancel;
	int m_MeanRows;///////////
	int m_MeanCols;///////////////添加控件变量(1):变量申明
	double m_OfferRate;////////////
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(ONorINData)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(ONorINData)
	virtual BOOL OnInitDialog();
	afx_msg void OnUpdateOfferRate();//添加文本控件消息函数(1):函数申明
		// NOTE: the ClassWizard will add member functions here
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};
ONorINData::ONorINData(CWnd* pParent /*=NULL*/)
	: CDialog(ONorINData::IDD, pParent)
{
	//{{AFX_DATA_INIT(ONorINData)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void ONorINData::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(ONorINData)
	DDX_Control(pDX, IDOK, m_OK);
	DDX_Control(pDX, IDCANCEL, m_Cancel);
	DDX_Text(pDX, IDC_MeanRows, m_MeanRows);//////////////
	DDX_Text(pDX, IDC_MeanCols, m_MeanCols);////添加控件变量(2):连接变量和控件ID
	DDX_Text(pDX, IDC_OfferRate, m_OfferRate);//////////////
	//}}AFX_DATA_MAP
}

BOOL ONorINData::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_OK.LoadBitmaps(IDB_BITMAP1,5, 5, 5, 5, 4 );
	m_Cancel.LoadBitmaps(IDB_BITMAP1,5, 5, 5, 5, 4 );
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
void ONorINData::OnUpdateOfferRate() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_UPDATE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(true);
	if(m_OfferRate>1 ||m_OfferRate<0)
	{
		MessageBox("    无效的累积贡献率   ","出错啦");
		m_OfferRate=0.8;
	}
	UpdateData(false);

}
BEGIN_MESSAGE_MAP(ONorINData, CDialog)
	//{{AFX_MSG_MAP(ONorINData)
	ON_EN_UPDATE(IDC_OfferRate, OnUpdateOfferRate)	//添加文本控件消息函数(2):连接函数和空间ID
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CSureExit dialog

class CSureExit : public CDialog
{//矩阵的确认退出
// Construction
public:
	CSureExit(CWnd* pParent = NULL);   // standard constructor
// Dialog Data
	//{{AFX_DATA(CSureExit)
	enum { IDD = IDD_SureEXIT };
	CWBButton	m_OK;
	CWBButton	m_Cancel;
	//}}AFX_DATA
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSureExit)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL
// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CSureExit)
	virtual BOOL OnInitDialog();
		// NOTE: the ClassWizard will add member functions here
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};
CSureExit::CSureExit(CWnd* pParent /*=NULL*/)
	: CDialog(CSureExit::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSureExit)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}
BOOL CSureExit::OnInitDialog() 
{
	CDialog::OnInitDialog();
	

⌨️ 快捷键说明

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