📄 usedoublependulumview.cpp
字号:
// UseDoublePendulumView.cpp : implementation of the CUseDoublePendulumView class
//
#include "stdafx.h"
#include "UseDoublePendulum.h"
#include "UseDoublePendulumDoc.h"
#include "UseDoublePendulumView.h"
#include "PendulumValue.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CUseDoublePendulumView
IMPLEMENT_DYNCREATE(CUseDoublePendulumView, CView)
BEGIN_MESSAGE_MAP(CUseDoublePendulumView, CView)
//{{AFX_MSG_MAP(CUseDoublePendulumView)
ON_COMMAND(ID_FILE_SETPENDULUMVALUE, OnFileSetpendulumvalue)
ON_WM_CREATE()
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUseDoublePendulumView construction/destruction
CUseDoublePendulumView::CUseDoublePendulumView()
{
}
CUseDoublePendulumView::~CUseDoublePendulumView()
{
}
BOOL CUseDoublePendulumView::PreCreateWindow(CREATESTRUCT& cs)
{
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CUseDoublePendulumView drawing
void CUseDoublePendulumView::OnDraw(CDC* pDC)
{
CUseDoublePendulumDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
}
/////////////////////////////////////////////////////////////////////////////
// CUseDoublePendulumView diagnostics
#ifdef _DEBUG
void CUseDoublePendulumView::AssertValid() const
{
CView::AssertValid();
}
void CUseDoublePendulumView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CUseDoublePendulumDoc* CUseDoublePendulumView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CUseDoublePendulumDoc)));
return (CUseDoublePendulumDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CUseDoublePendulumView message handlers
int CUseDoublePendulumView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
SetTimer( 1, 100, NULL );
return 0;
}
void CUseDoublePendulumView::OnTimer(UINT nIDEvent)
{
if( !m_bCreated ){
m_bCreated = TRUE;
RECT Rect;
Rect.left = Rect.top = 0;
Rect.right = Rect.bottom = 400;
m_DoublePendulum.Create( "DoublePendulum",
WS_VISIBLE, Rect, this, 0x5005 );
}
else
m_DoublePendulum.Update();
CView::OnTimer(nIDEvent);
}
void CUseDoublePendulumView::OnFileSetpendulumvalue()
{
CPendulumValue PendulumValue;
if( PendulumValue.DoModal() == IDOK )
m_DoublePendulum.SetValue(
(double) atof( PendulumValue.m_strPendulumValue ) );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -