1) . View à ClassWizard Message Maps, Class name: CMotorView Object IDs, , . Messages COMMAND, Add Function . .
2) , :
void CMotorView::OnInitial()
{
// TODO: Add your command handler code here
}
void CMotorView::OnPrevious()
{
// TODO: Add your command handler code here
}
void CMotorView::OnNext()
{
// TODO: Add your command handler code here
}
void CMotorView::OnParameters()
{
// TODO: Add your command handler code here
}
3) OnInitial() ( ):
void CMotorView::OnInitial()
{
// TODO: Add your command handler code here
à a = 0;
à Background();
à LeadOutParameters();
à DRAW();
}
4) OnPrevious() , OnNext . :
void CMotorView::OnPrevious()
{
// TODO: Add your command handler code here
à if (a==2*PI) a = 0;
à a += 15 * PI/180;
à Background();
à LeadOutParameters();
à DRAW();
}
void CMotorView::OnNext()
{
// TODO: Add your command handler code here
à if (a==2*PI) a = 0;
à a -= 15 * PI/180;
à Background();
à LeadOutParameters();
à DRAW();
}
. 3.8.1. Parameters |
3.8. Parameters
1) Workspace ResourceView, Dialog, Insert Dialog. OK Cancel.
2) , : ) ( ), ) , . , , .
3) : IDC_EDIT_AB, IDC_EDIT_BC, IDC_EDIT_BD, IDC_EDIT_DE, IDC_EDIT_N, IDC_EDIT_CBD. : IDC_BUTTON_DATA.
4) View à ClassWizard Member Variables, Class name: DlgParameters , Control IDs , Add Variable :
Control IDs: | Type | Member |
IDC_EDIT_AB | int | m_AB |
IDC_EDIT_BC | int | m_BC |
IDC_EDIT_BD | int | m_BD |
IDC_EDIT_DE | int | m_DE |
IDC_EDIT_N | int | m_N |
IDC_EDIT_CBD | double | m_CBD |
5) View à ClassWizard Message Maps, Class name: DlgParameters Object IDs, IDC_BUTTON_DATA, Messages BN_CLICKED, Add Function , Edit Code. pgbitv :
|
|
void DlgParameters::OnButtonData()
{
// TODO: Add your control notification handler code here
à UpdateData(true);
à m_AB = 6;
à m_BC = 35;
à BD = 3;
à E = 32;
à N = 1;
à CBD = 75.;
à dateData(false);
}
, .
6) , DlgParameters.cpp :
DlgParameters::DlgParameters(CWnd* pParent /*=NULL*/)
: CDialog(DlgParameters::IDD, pParent)
{
//{{AFX_DATA_INIT(DlgParameters)
à m_AB = 6;
à m_BC = 35;
à m_BD = 3;
à m_CBD = 75.0;
à m_DE = 32;
à m_N = 1;
//}}AFX_DATA_INIT
}