📄 mywizardcontrol.cpp
字号:
// MyWizardcontrol.cpp: implementation of the CMyWizardcontrol class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "front.h"
#include "MyWizardcontrol.h"
#include "InputBox.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CMyWizardcontrol::CMyWizardcontrol()
{
}
CMyWizardcontrol::~CMyWizardcontrol()
{
int i=0,AllCount=arPages.GetSize();
CMySheetpage *temp;
for(i=0;i<AllCount;i++)
{
temp=(CMySheetpage *)arPages.GetAt(i);
if(temp)
delete temp;
}
if(AllCount>0)arPages.RemoveAll();
}
void CMyWizardcontrol::Uppage()
{
if(iStep-1<0)return;
iStep--;
if(iStep==0) //第一页
{
((CInputBox *)pParentWnd->GetOwner())->RTButton->iFlag=2;
((CInputBox *)pParentWnd->GetOwner())->RTButton->Invalidate();
iCurrentPage=0;
}
if(iStep>0) //不是第一页
{
((CInputBox *)pParentWnd->GetOwner())->RTButton->iFlag=3;
((CInputBox *)pParentWnd->GetOwner())->RTButton->Invalidate();
((CMySheetpage *)arPages.GetAt(iCurrentPage))->bIsNext=true;
iCurrentPage=trace[iStep];
}
pParentWnd->SendMessage(WM_ACCEPT,IDC_UPPAGE,0);
pParentWnd->Invalidate();
}
void CMyWizardcontrol::Downpage()
{
if(iStep+1==arPages.GetSize())return;
trace[iStep]=iCurrentPage;
if(((CMySheetpage *)arPages.GetAt(iCurrentPage))->bIsNext==false) //改变了页的顺序
{
iCurrentPage=((CMySheetpage *)arPages.GetAt(iCurrentPage))->iResult;
}
else
if(iCurrentPage+1<arPages.GetSize())
{
iCurrentPage+=1;
}
if(iCurrentPage+1==arPages.GetSize()) //是最后一页
{
((CInputBox *)pParentWnd->GetOwner())->RTButton->iFlag=4;
((CInputBox *)pParentWnd->GetOwner())->RTButton->Invalidate();
}
if(iCurrentPage+1<arPages.GetSize())
{
((CInputBox *)pParentWnd->GetOwner())->RTButton->iFlag=3;
((CInputBox *)pParentWnd->GetOwner())->RTButton->Invalidate();
}
iStep++;
pParentWnd->SendMessage(WM_ACCEPT,IDC_DOWNPAGE,0);
pParentWnd->Invalidate();
}
void CMyWizardcontrol::setPos(CRect rc)
{
WizardRect=rc;
}
void CMyWizardcontrol::AddPage(CMySheetpage *page)
{
arPages.Add((void *)page);
}
void CMyWizardcontrol::draw(CDC *pDC)
{
int i=0,AllCount=arPages.GetSize();
CMySheetpage *temp;
for(i=0;i<AllCount;i++)
{
temp=(CMySheetpage *)arPages.GetAt(i);
if(i!=iCurrentPage)
{
temp->setEnable(false);
temp->setVisible(false);
}
else
{
temp->setEnable(true);
temp->setVisible(true);
temp->draw(pDC);
}
}
}
CMyWizardcontrol::CMyWizardcontrol(CWnd *parent)
{
iCurrentPage=0;
pParentWnd=parent;
iStep=0;
bEnabel=true;
}
void CMyWizardcontrol::OnMouseMove(CPoint point)
{
if(!bEnabel)return;
if(arPages.GetSize()>0)
((CMySheetpage *)arPages.GetAt(iCurrentPage))->OnMouseMove(point);
}
void CMyWizardcontrol::OnRButtonDown(CPoint point)
{
if(!bEnabel)return;
if(arPages.GetSize()>0)
((CMySheetpage *)arPages.GetAt(iCurrentPage))->OnRButtonDown(point);
}
void CMyWizardcontrol::OnLButtonUp(CPoint point)
{
if(!bEnabel)return;
if(arPages.GetSize()>0)
((CMySheetpage *)arPages.GetAt(iCurrentPage))->OnLButtonUp(point);
}
void CMyWizardcontrol::OnLButtonDown(CPoint point)
{
if(!bEnabel)return;
if(arPages.GetSize()>0)
((CMySheetpage *)arPages.GetAt(iCurrentPage))->OnLButtonDown(point);
}
void CMyWizardcontrol::OnTimer()
{
if(arPages.GetSize()>0)
((CMySheetpage *)arPages.GetAt(iCurrentPage))->OnTimer();
}
void CMyWizardcontrol::outRect()
{
if(arPages.GetSize()>0)
((CMySheetpage *)arPages.GetAt(iCurrentPage))->OutRect();
}
void CMyWizardcontrol::setEnable(bool enable)
{
if(bEnabel!=enable)
bEnabel=enable;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -