📄 testformview.cpp
字号:
// TestFormView.cpp : implementation of the CTestFormView class
//
#include "stdafx.h"
#include "TestForm.h"
#include "TestFormDoc.h"
#include "TestFormView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define totalDialog 8 //定义绘图窗口中需要显示的对话框总数
/////////////////////////////////////////////////////////////////////////////
// CTestFormView
IMPLEMENT_DYNCREATE(CTestFormView, CFormView)
BEGIN_MESSAGE_MAP(CTestFormView, CFormView)
//{{AFX_MSG_MAP(CTestFormView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTestFormView construction/destruction
CTestFormView::CTestFormView()
: CFormView(CTestFormView::IDD)
{
//{{AFX_DATA_INIT(CTestFormView)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// TODO: add construction code here
m_nCurrPage = 0;
memset( m_arhwndPage, 0, sizeof(HWND)*10 );
}
CTestFormView::~CTestFormView()
{
}
void CTestFormView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTestFormView)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BOOL CTestFormView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CFormView::PreCreateWindow(cs);
}
void CTestFormView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// GetParentFrame()->RecalcLayout();
// ResizeParentToFit();
//--------------创建绘图区域中的各个对话框---开始------------------////
CTestFormApp *pApp=(CTestFormApp *)AfxGetApp();
pApp->pCTestFormView =this;
// CRect drawBaseFrm;
// GetWindowRect(drawBaseFrm);
//效率试验绘图对话框
powerDrawDlg.Create(IDD_DRAWDIALOG_POWER,this);
m_arhwndPage[1]=powerDrawDlg.GetSafeHwnd();
//超载试验绘图对话框
overDrawDlg.Create(IDD_DRAWDIALOG_OVER,this);
m_arhwndPage[2]=overDrawDlg.GetSafeHwnd();
//传动精度试验绘图对话框
prvDrawDlg.Create(IDD_DRAWDIALOG_PRV,this);
m_arhwndPage[3]=prvDrawDlg.GetSafeHwnd();
//过度过程试验绘图对话框
respDrawDlg.Create(IDD_DRAWDIALOG_RESP,this);
m_arhwndPage[4]=respDrawDlg.GetSafeHwnd();
//启动力矩试验绘图对话框
startDrawDlg.Create(IDD_DRAWDIALOG_START,this);
m_arhwndPage[5]=startDrawDlg.GetSafeHwnd();
//空程回差试验绘图对话框
blankeDrawDlg.Create(IDD_DRAWDIALOG_BLANKE,this);
m_arhwndPage[6]=blankeDrawDlg.GetSafeHwnd();
//刚度及回差试验绘图对话框
rigidDrawDlg.Create(IDD_DRAWDIALOG_RIGID,this);
m_arhwndPage[7]=rigidDrawDlg.GetSafeHwnd();
//ScreenToClient( &drawBaseFrm );
// for(int i=0;i<totalDialog;i++)
// {
// ::MoveWindow( m_arhwndPage[ i ],
// drawBaseFrm.left+2, drawBaseFrm.top+2, drawBaseFrm.Width()-4, drawBaseFrm.Height()-4,
// 0 );
// }
::ShowWindow( m_arhwndPage[0], SW_SHOW );
////----------创建绘图区域中的各个对话框---结束----------------////
}
/////////////////////////////////////////////////////////////////////////////
// CTestFormView diagnostics
#ifdef _DEBUG
void CTestFormView::AssertValid() const
{
CFormView::AssertValid();
}
void CTestFormView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
CTestFormDoc* CTestFormView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTestFormDoc)));
return (CTestFormDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTestFormView message handlers
//绘图对话框中的窗口切换
void CTestFormView::DrawSwitchView(int nview)
{
//DWORD flag = AW_SLIDE | AW_HOR_POSITIVE;
//DWORD flag = AW_SLIDE | AW_CENTER;
DWORD flag =AW_BLEND;
//动态切换窗口
BOOL b =::AnimateWindow(
m_arhwndPage[ nview ],
300,
flag
);
// MessageBox("123");
for (int i=0;i<nview;i++)
{
::ShowWindow( m_arhwndPage[ i ], SW_HIDE );
}
for (int j=nview+1;j<totalDialog;j++)
{
::ShowWindow( m_arhwndPage[ j ], SW_HIDE );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -