⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 infocurve.cpp

📁 波峰焊后台控制软件-英文版
💻 CPP
字号:
// InfoCurve.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "InfoCurve.h"
#include "FLADS.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CInfoCurve
extern CFLADSApp theApp;
CInfoCurve::CInfoCurve()
{
}

CInfoCurve::~CInfoCurve()
{
}


BEGIN_MESSAGE_MAP(CInfoCurve, CStatic)
	//{{AFX_MSG_MAP(CInfoCurve)
	ON_WM_PAINT()
	ON_WM_TIMER()
	ON_WM_CREATE()
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CInfoCurve message handlers

void CInfoCurve::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	int i,j;
	CString string;
	CString  str;
	CRect *mm_rect;
    struct Mail  *p;
	unsigned char  ch;

	dc.SetBkColor(RGB(158, 189, 224));
	dc.SetBkMode(OPAQUE);

	GetClientRect(&rect);
	CBrush brush(RGB(158, 189, 224));
	dc.FillRect(rect, &brush);


	x=(rect.Width()-20)/800.0;
	y=(rect.Height()-20)/20.0;

	LOGFONT lf;
	CFont Font, *PtrOldFont;
   	memset(&lf, 0, sizeof(LOGFONT));
	lf.lfHeight = 24;
	lstrcpy(lf.lfFaceName, _T("宋体"));
	Font.CreateFontIndirect(&lf); 


	PtrOldFont = dc.SelectObject(&Font);//--
	dc.SetTextColor(RGB(0, 0, 255));

/* buf[0] 	//0AAH
   buf[1] 	//055H
   buf[2] 	//命令
   buf[3] 	//长度15
   buf[4] 	//年
   buf[5] 	//月
   buf[6] 	//日
   buf[7] 	//时
   buf[8]   //分
   buf[9] 	//秒
   buf[10] 	//毫秒低
   buf[11] 	//毫秒高
   buf[12]	//开关序号低字节
   buf[13]	//开关序号高字节
   buf[14]	//0:负跳变   1:正跳变
*/


	p=NULL;
    switch(theApp.ControlMode)
	{
	case  Info_Window://信息窗
						if(theApp.SoeHead.MailQueueLength!=0)
						{
							 p=theApp.SoeHead.MailQueueHead;
							 if(theApp.SoePage>0)
							 {
								 for(i=0;i<theApp.SoePage;i++)
								 {
									 if(p->Link!=NULL)     p=p->Link;	
									 else  {
											   p=NULL;
											   i=2000;
											}
								 }
							 }
						}

						for(i=0;i<20;i++)
						{
							 j=i+theApp.SoePage+1;
							 string.Format(_T("%03d"), j);
							 string =string+_T(":");
							 if(p!=NULL)
							 {
								 str.Format(_T("%4d:"),   p->Data[4]+1792);
								 string =string+str;
								 str.Format(_T("%02d:"),  p->Data[5]);
								 string =string+str;
								 str.Format(_T("%02d "),  p->Data[6]);
								 string =string+str;
								 str.Format(_T("%02d:"),  p->Data[7]);
								 string =string+str;
								 str.Format(_T("%02d:"),  p->Data[8]);
								 string =string+str;
								 str.Format(_T("%02d "),  p->Data[9]);
								 string =string+str;
                                 switch(p->Data[11])
								 {
								 case 0: //开机  复位
										 string= string+ theApp.informatiom[p->Data[12]];
										 if(p->Link!=NULL)     p=p->Link;
										       else  		   p=NULL;
									     break;
								 case 1: //开始登录
										 string=string+(CString)theApp.m_UserPower.Operators[p->Data[13]].OperatorName+ theApp.informatiom[p->Data[12]];
										 if(p->Link!=NULL)     p=p->Link;
										       else  		   p=NULL;
									     break;
								 case 2: //撤消登录
										 string= string + (CString)theApp.m_UserPower.Operators[p->Data[13]].OperatorName+ theApp.informatiom[p->Data[12]];
										 if(p->Link!=NULL)     p=p->Link;
										       else  		   p=NULL;
										 break;
								 }
							 }else
							 {

							 }

							 ExtTextOut(dc,rect.left+10,rect.top+10+y*i,ETO_OPAQUE,mm_rect,string, string.GetLength(),NULL);
						}
					  break;
	case  Warn_Window://告警窗
						if(theApp.WarnHead.MailQueueLength!=0)
						{
							 p=theApp.WarnHead.MailQueueHead;
							 if(theApp.WarnPage>0)
							 {
								 for(i=0;i<theApp.WarnPage;i++)
								 {
									 if(p->Link!=NULL)     p=p->Link;	
									 else  {
											   p=NULL;
											   i=2000;
											}
								 }
							 }
						}

						for(i=0;i<20;i++)
						{
							 j=i+theApp.WarnPage+1;
							 string.Format(_T("%03d"), j);
							 string =string+_T(":");
							 if(p!=NULL)
							 {
								 str.Format(_T("%4d:"),   p->Data[4]+1792);
								 string =string+str;
								 str.Format(_T("%02d:"),  p->Data[5]);
								 string =string+str;
								 str.Format(_T("%02d "),  p->Data[6]);
								 string =string+str;
								 str.Format(_T("%02d:"),  p->Data[7]);
								 string =string+str;
								 str.Format(_T("%02d:"),  p->Data[8]);
								 string =string+str;
								 str.Format(_T("%02d   "),  p->Data[9]);
								 string =string+str;

								 string= string+ theApp.Warninformatiom[p->Data[12]];
								 if(p->Data[14]==0)
								 {
									string =string+_T("  Reset!");;
								 }else
								 {
									string =string+_T("  Warned!");
								 }
								 if(p->Link!=NULL)     p=p->Link;
								       else  		   p=NULL;

							 }else
							 {

							 }
							 ExtTextOut(dc,rect.left+10,rect.top+10+y*i,ETO_OPAQUE,mm_rect,string, string.GetLength(),NULL);
						}
					  break;
	}


    dc.SelectObject(PtrOldFont);//++
	
	// Do not call CStatic::OnPaint() for painting messages
}

void CInfoCurve::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	CStatic::OnTimer(nIDEvent);
}


void CInfoCurve::Display(void) 
{
	// TODO: Add your message handler code here and/or call default
	int i,j;
	CString string;
	CString  ch[4];

/*


	CDC *pDC=GetDC();

	pDC->SetBkColor(RGB(158, 189, 224));
	pDC->SetBkMode(OPAQUE);

	LOGFONT lf;
	CFont Font, *PtrOldFont;
   	memset(&lf, 0, sizeof(LOGFONT));
	lf.lfHeight = 24;
	lstrcpy(lf.lfFaceName, "宋体");
	Font.CreateFontIndirect(&lf); 
	PtrOldFont = pDC->SelectObject(&Font);//--
	pDC->SetTextColor(RGB(0, 0, 255));
    for(i=0;i<20;i++)
	{
         j=i+infonum+1;
         ch[2]=(CString)((j%10)+0x30); j=j/10;
		 ch[1]=(CString)((j%10)+0x30); j=j/10;
		 ch[0]=(CString)((j%10)+0x30); 
		 ch[3]=":";
		 string =ch[0]+ch[1]+ch[2]+ch[3];
	     pDC->TextOut(rect.left+10, rect.top+10+y*i, string, string.GetLength());
	}
	pDC->SetTextColor(RGB(0, 0, 0));
    for(i=0;i<20;i++)
	{
		 string =infostr[i+infonum];
	     pDC->TextOut(rect.left+60, rect.top+10+y*i, string, string.GetLength());
	}
	if(infoclr!=0)
	{
		infoclr=0;
        ClrInfo();
	}
    pDC->SelectObject(PtrOldFont);//++
  	ReleaseDC (pDC);
*/
}




int CInfoCurve::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CStatic::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
//	SetTimer (2003,500,NULL);	
	return 0;
}

void CInfoCurve::OnDestroy() 
{
	CStatic::OnDestroy();
	
	// TODO: Add your message handler code here
//	KillTimer(2003);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -