📄 mysheetpage.cpp
字号:
// MySheetpage.cpp: implementation of the CMySheetpage class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "front.h"
#include "MySheetpage.h"
#include "MyEdit.h"
#include "MyLabel.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CMySheetpage::CMySheetpage()
{
bIsNext=true;
iResult=-1;
bEnable=true;
bCreateEdit=false;
bVisible=true;
}
CMySheetpage::~CMySheetpage()
{
cleanLabel();
cleanList();
cleanQFace();
}
void CMySheetpage::Init(char *title,int shape,CWnd *parent,bool fromfile,char *filename)
{
if (title)
{
cTitle = new char[lstrlen(title)+1];
ASSERT(cTitle);
lstrcpy(cTitle, title);
}
iShape=shape;
pParentWnd=parent;
IsFile=fromfile;
if (filename)
{
cFilename = new char[lstrlen(filename)+1];
ASSERT(cFilename);
lstrcpy(cFilename, filename);
}
}
void CMySheetpage::draw(CDC *pDC)
{
int i=0,AllCount=arLabels.GetSize();
CMyLabel *temp1;
for(i=0;i<AllCount;i++)
{
temp1=(CMyLabel *)arLabels.GetAt(i);
if(temp1)temp1->DrawLabel(pDC);
}
i=0,AllCount=arLists.GetSize();
CMyList *temp2;
for(i=0;i<AllCount;i++)
{
temp2=(CMyList *)arLists.GetAt(i);
if(temp2)temp2->draw(pDC);
}
i=0,AllCount=arQFaces.GetSize();
CQQFace *temp4;
for(i=0;i<AllCount;i++)
{
temp4=(CQQFace *)arQFaces.GetAt(i);
if(temp4)temp4->draw(pDC);
}
}
void CMySheetpage::setPos(CRect rc)
{
PageRect=rc;
}
void CMySheetpage::AddItem(CMyLabel *label)
{
arLabels.Add((void *)label);
}
void CMySheetpage::AddItem(CMyList *list)
{
arLists.Add((void *)list);
}
void CMySheetpage::AddItem(CQQFace *qface)
{
arQFaces.Add((void *)qface);
}
void CMySheetpage::OutRect()
{
if(!bEnable)return;
int i=0,AllCount=arLabels.GetSize();
CMyLabel *temp1;
for(i=0;i<AllCount;i++)
{
temp1=(CMyLabel *)arLabels.GetAt(i);
if(temp1)temp1->OutRect();
}
i=0,AllCount=arLists.GetSize();
CMyList *temp2;
for(i=0;i<AllCount;i++)
{
temp2=(CMyList *)arLists.GetAt(i);
if(temp2)temp2->OutRect();
}
i=0,AllCount=arQFaces.GetSize();
CQQFace *temp4;
for(i=0;i<AllCount;i++)
{
temp4=(CQQFace *)arQFaces.GetAt(i);
if(temp4)temp4->OutRect();
}
}
void CMySheetpage::OnMouseMove(CPoint point)
{
if(!bEnable)return;
int i=0,AllCount=arLabels.GetSize();
CMyLabel *temp1;
for(i=0;i<AllCount;i++)
{
temp1=(CMyLabel *)arLabels.GetAt(i);
if(temp1)temp1->OnMouseMove(point);
}
i=0,AllCount=arLists.GetSize();
CMyList *temp2;
for(i=0;i<AllCount;i++)
{
temp2=(CMyList *)arLists.GetAt(i);
if(temp2)temp2->OnMouseMove(point);
}
i=0,AllCount=arQFaces.GetSize();
CQQFace *temp4;
for(i=0;i<AllCount;i++)
{
temp4=(CQQFace *)arQFaces.GetAt(i);
if(temp4)temp4->OnMouseMove(point);
}
}
void CMySheetpage::OnRButtonDown(CPoint point)
{
if(!bEnable)return;
int i=0,AllCount=arLabels.GetSize();
CMyLabel *temp1;
for(i=0;i<AllCount;i++)
{
temp1=(CMyLabel *)arLabels.GetAt(i);
if(temp1)temp1->OnRButtonDown(point);
}
i=0,AllCount=arLists.GetSize();
CMyList *temp2;
for(i=0;i<AllCount;i++)
{
temp2=(CMyList *)arLists.GetAt(i);
if(temp2)temp2->OnRButtonDown(point);
}
i=0,AllCount=arQFaces.GetSize();
CQQFace *temp4;
for(i=0;i<AllCount;i++)
{
temp4=(CQQFace *)arQFaces.GetAt(i);
if(temp4)temp4->OnRButtonDown(point);
}
}
void CMySheetpage::OnLButtonUp(CPoint point)
{
if(!bEnable)return;
int i=0,AllCount=arLabels.GetSize();
CMyLabel *temp1;
for(i=0;i<AllCount;i++)
{
temp1=(CMyLabel *)arLabels.GetAt(i);
if(temp1)temp1->OnLButtonUp(point);
}
i=0,AllCount=arLists.GetSize();
CMyList *temp2;
for(i=0;i<AllCount;i++)
{
temp2=(CMyList *)arLists.GetAt(i);
if(temp2)temp2->OnLButtonUp(point);
}
i=0,AllCount=arQFaces.GetSize();
CQQFace *temp4;
for(i=0;i<AllCount;i++)
{
temp4=(CQQFace *)arQFaces.GetAt(i);
if(temp4)temp4->OnLButtonUp(point);
}
}
void CMySheetpage::OnLButtonDown(CPoint point)
{
if(!bEnable)return;
int i=0,AllCount=arLabels.GetSize();
CMyLabel *temp1;
for(i=0;i<AllCount;i++)
{
temp1=(CMyLabel *)arLabels.GetAt(i);
if(temp1)temp1->OnLButtonDown(point);
}
i=0,AllCount=arLists.GetSize();
CMyList *temp2;
for(i=0;i<AllCount;i++)
{
temp2=(CMyList *)arLists.GetAt(i);
if(temp2)temp2->OnLButtonDown(point);
}
i=0,AllCount=arQFaces.GetSize();
CQQFace *temp4;
for(i=0;i<AllCount;i++)
{
temp4=(CQQFace *)arQFaces.GetAt(i);
if(temp4)temp4->OnLButtonDown(point);
}
}
void CMySheetpage::cleanLabel()
{
int i=0,AllCount=arLabels.GetSize();
CMyLabel *temp;
for(i=0;i<AllCount;i++)
{
temp=(CMyLabel *)arLabels.GetAt(i);
if(temp)
delete temp;
}
if(AllCount>0)arLabels.RemoveAll();
}
void CMySheetpage::cleanList()
{
int i=0,AllCount=arLists.GetSize();
CMyList *temp;
for(i=0;i<AllCount;i++)
{
temp=(CMyList *)arLists.GetAt(i);
if(temp)
delete temp;
}
if(AllCount>0)arLists.RemoveAll();
}
void CMySheetpage::cleanQFace()
{
int i=0,AllCount=arQFaces.GetSize();
CQQFace *temp;
for(i=0;i<AllCount;i++)
{
temp=(CQQFace *)arQFaces.GetAt(i);
if(temp)
delete temp;
}
if(AllCount>0)arQFaces.RemoveAll();
}
void CMySheetpage::setEnable(bool enable)
{
bEnable=enable;
}
void CMySheetpage::OnTimer()
{
int i=0,AllCount=arLists.GetSize();
CMyList *temp;
for(i=0;i<AllCount;i++)
{
temp=(CMyList *)arLists.GetAt(i);
if(temp)
temp->OnTimer();
}
i=0,AllCount=arQFaces.GetSize();
CQQFace *temp1;
for(i=0;i<AllCount;i++)
{
temp1=(CQQFace *)arQFaces.GetAt(i);
if(temp1)
temp1->OnTimer();
}
}
void CMySheetpage::setVisible(bool visible)
{
if(bVisible==visible)return;
int i=0,AllCount=arLabels.GetSize();
CMyLabel *temp;
for(i=0;i<AllCount;i++)
{
temp=(CMyLabel *)arLabels.GetAt(i);
if(temp->iShape==5)
{
if(visible==false)temp->pEdit->ShowWindow(SW_HIDE);//temp->pEdit->PostMessage(WM_CLOSE, 0, 0);
else temp->pEdit->ShowWindow(SW_SHOW);
}
}
bVisible=visible;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -