📄 dlgtrain.cpp
字号:
// DlgTrain.cpp : implementation file
//
#include "stdafx.h"
#include "NeuralNetwork.h"
#include "DlgTrain.h"
#include "MainFrm.h"
#include "NeuralNetworkView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgTrain dialog
CDlgTrain::CDlgTrain(CWnd* pParent /*=NULL*/)
: CDialog(CDlgTrain::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgTrain)
m_maxstep = 0;
m_learn = 0.0f;
//}}AFX_DATA_INIT
}
void CDlgTrain::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgTrain)
DDX_Text(pDX, IDC_EDIT_MAXSTEP, m_maxstep);
DDV_MinMaxInt(pDX, m_maxstep, 1, 10000);
DDX_Text(pDX, IDC_EDIT_LEARN, m_learn);
DDV_MinMaxFloat(pDX, m_learn, 0.f, 1.f);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgTrain, CDialog)
//{{AFX_MSG_MAP(CDlgTrain)
ON_BN_CLICKED(IDC_BTN_TRAIN, OnBtnTrain)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgTrain message handlers
void CDlgTrain::OnBtnTrain()
{
// TODO: Add your control notification handler code here
CFileDialog dlgOpen(TRUE,_T("txt"),_T(".txt"),OFN_OVERWRITEPROMPT,_T("文本文件(*.txt)|*.txt|"));
if(IDOK==dlgOpen.DoModal())
{
CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();
CNeuralNetworkDoc* pDoc = (CNeuralNetworkDoc*) pMainFrame->GetActiveDocument();
SetDlgItemText(IDC_EDIT_TRAIN,dlgOpen.GetPathName());
}
else
{
AfxMessageBox("文件无法打开!");
}
}
void CDlgTrain::OnOK()
{
// TODO: Add extra validation here
UpdateData(true);
CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();
CNeuralNetworkDoc* pDoc = (CNeuralNetworkDoc*) pMainFrame->GetActiveDocument();
CString pathName;
GetDlgItemText(IDC_EDIT_TRAIN,pathName);
pDoc->neuralNetwork.networkTrain(pathName,m_maxstep,m_learn);
CDialog::OnOK();
}
BOOL CDlgTrain::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_maxstep=1000;
m_learn=0.5;
//======将变量中的数据传入控件=========
UpdateData(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -