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

📄 curvedata.cpp

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

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

/////////////////////////////////////////////////////////////////////////////
// CCurveData
extern CFLADSApp theApp;
CCurveData::CCurveData()
{
	int i;
	for(i=0;i<3;i++)
	{
	    test[i]=0;
	}
	flash=0;
    flash_face=0;
}

CCurveData::~CCurveData()
{
}


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

/////////////////////////////////////////////////////////////////////////////
// CCurveData message handlers

void CCurveData::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here

	int Leny;
	int t[10],v,i,j;
	int  flag;
	GetClientRect(&m_rectClient);
	Leny=m_rectClient.bottom-m_rectClient.top;


	CDC memDC;
	memDC.CreateCompatibleDC(&dc);
    CBitmap* pOld;

    if(theApp.OldControlMode!=Curve_Window)
	{
		flash=0;
		theApp.curve_flash=0xff;
	}
    theApp.OldControlMode=Curve_Window;
	if(flash_face==0)  flash=0;
	if(flash==0)
	{
		pOld = memDC.SelectObject(theApp.fillbitmap[143]);
		if (pOld == NULL)return;     // destructors will clean up
		dc.BitBlt(m_rectClient.left, m_rectClient.top, m_rectClient.Width(), m_rectClient.Height(),
			&memDC, 0, 0, SRCCOPY);
		memDC.SelectObject(pOld);
	}

	for(j=0;j<3;j++)
	{
	    if(theApp.test_flag[j]!=0)
		{
			v=(int)test[j];
			if(v<0) 
			{
				v=-v;
				t[0]=161;
			}else  t[0]=162;
    
			t[5]=(v%10)+150; v=v/10;
			t[4]=160;//.
			t[3]=(v%10)+150; v=v/10;
			t[2]=(v%10)+150; v=v/10;
			t[1]=(v%10)+150; v=v/10;

			for(i=0;i<6;i++)
			{
				pOld = memDC.SelectObject(theApp.fillbitmap[t[i]]);
				if (pOld == NULL)return;     // destructors will clean up
				dc.BitBlt(m_rectClient.left+408+i*8+j*64, m_rectClient.top+62, m_rectClient.Width(), m_rectClient.Height(),
					&memDC, 0, 0, SRCCOPY);
				memDC.SelectObject(pOld);
			}
		}
	}

    //传送速度

    v=(int)(theApp.CTransConSpeed);
	if(v<0)
	{
				v=-v;
				t[0]=161;
			}else  t[0]=162;
    
			t[4]=(v%10)+150; v=v/10;
			t[3]=(v%10)+150; v=v/10;
			t[2]=(v%10)+150; v=v/10;
			t[1]=(v%10)+150; v=v/10;

			for(i=1;i<5;i++)
			{
				pOld = memDC.SelectObject(theApp.fillbitmap[t[i]]);
				if (pOld == NULL)return;     // destructors will clean up
				dc.BitBlt(m_rectClient.left+730+i*8, m_rectClient.top+25, m_rectClient.Width(), m_rectClient.Height(),
					&memDC, 0, 0, SRCCOPY);
				memDC.SelectObject(pOld);
	}


    //最高温度-----------------------------------
	for(j=0;j<3;j++)
	{
	    if(theApp.test_flag[j]!=0)
		{

		    v=(int)(theApp.MaxTemper[j]);
			if(v<0)
			{
				v=-v;
				t[0]=161;
			}else  t[0]=162;
    
			t[5]=(v%10)+150; v=v/10;
			t[4]=160;//.
			t[3]=(v%10)+150; v=v/10;
			t[2]=(v%10)+150; v=v/10;
			t[1]=(v%10)+150; v=v/10;

			for(i=0;i<6;i++)
			{
				pOld = memDC.SelectObject(theApp.fillbitmap[t[i]]);
				if (pOld == NULL)return;     // destructors will clean up
				dc.BitBlt(m_rectClient.left+408+i*8+j*64, m_rectClient.top+25, m_rectClient.Width(), m_rectClient.Height(),
					&memDC, 0, 0, SRCCOPY);
				memDC.SelectObject(pOld);
			}
		}
	}


	if(theApp.vTESTfg!=0)
	{
       // 曲线温度-----------------------------------
		for(j=0;j<3;j++)
		{
			if(theApp.test_flag[j]!=0)
			{

				v=(int)(theApp.Curve_Temper[j]);
				if(v<0) 
				{
					v=-v;
					t[0]=161;
				}else  t[0]=162;
    
				t[5]=(v%10)+150; v=v/10;
				t[4]=160;//.
				t[3]=(v%10)+150; v=v/10;
				t[2]=(v%10)+150; v=v/10;
				t[1]=(v%10)+150; v=v/10;

				for(i=0;i<6;i++)
				{
					pOld = memDC.SelectObject(theApp.fillbitmap[t[i]]);
					if (pOld == NULL)return;     // destructors will clean up
					dc.BitBlt(m_rectClient.left+78+i*8+j*64, m_rectClient.top+25, m_rectClient.Width(), m_rectClient.Height(),
						&memDC, 0, 0, SRCCOPY);
					memDC.SelectObject(pOld);
				}
			}
		}
		//-----垂直温差---------------------------------
		
	    v=(int)(theApp.VTdx);
		if(v<0) 
		{
				v=-v;
			  t[0]=161;
		}else  t[0]=162;
    
		t[5]=(v%10)+150; v=v/10;
		t[4]=160;//.
		t[3]=(v%10)+150; v=v/10;
		t[2]=(v%10)+150; v=v/10;
		t[1]=(v%10)+150; v=v/10;

		for(i=1;i<6;i++)
		{
			pOld = memDC.SelectObject(theApp.fillbitmap[t[i]]);
			if (pOld == NULL)return;     // destructors will clean up
			dc.BitBlt(m_rectClient.left+730+i*8, m_rectClient.top+4, m_rectClient.Width(), m_rectClient.Height(),
				&memDC, 0, 0, SRCCOPY);
			memDC.SelectObject(pOld);
		}

        //----------加热时间 ---------------------   
	    v=(int)(theApp.AHotTime);
		if(v<0) 
		{
				v=-v;
				t[0]=161;
		}else  t[0]=162;
    
		t[5]=(v%10)+150; v=v/10;
		t[4]=160;//.
		t[3]=(v%10)+150; v=v/10;
		t[2]=(v%10)+150; v=v/10;
		t[1]=(v%10)+150; v=v/10;
 		for(j=0;j<3;j++)
		{
			if(theApp.test_flag[j]!=0)
			{
				for(i=0;i<6;i++)
				{
					pOld = memDC.SelectObject(theApp.fillbitmap[t[i]]);
					if (pOld == NULL)return;     // destructors will clean up
					dc.BitBlt(m_rectClient.left+78+i*8+j*64, m_rectClient.top+42, m_rectClient.Width(), m_rectClient.Height(),
						&memDC, 0, 0, SRCCOPY);
					memDC.SelectObject(pOld);
				}
			}
		}
	}
    //-----曲线斜率----------------------------------
	for(j=0;j<3;j++)
	{
			if(theApp.test_flag[j]!=0)
			{

					v=(int)(theApp.Curve_Scale[j]);
					if(v<0) 
					{
						v=-v;
						t[0]=161;
					}else  t[0]=162;
    
					t[5]=(v%10)+150; v=v/10;
					t[4]=160;//.
					t[3]=(v%10)+150; v=v/10;
					t[2]=(v%10)+150; v=v/10;
					t[1]=(v%10)+150; v=v/10;

					for(i=0;i<6;i++)
					{
						pOld = memDC.SelectObject(theApp.fillbitmap[t[i]]);
						if (pOld == NULL)return;     // destructors will clean up
						dc.BitBlt(m_rectClient.left+78+i*8+j*64, m_rectClient.top+62, m_rectClient.Width(), m_rectClient.Height(),
							&memDC, 0, 0, SRCCOPY);
						memDC.SelectObject(pOld);
					}
			}

			//--------------------水平温差--------------------------
			for(j=0;j<3;j++)
			{
					if(theApp.test_flag[j]!=0)
					{

						v=(int)(theApp.lTdx[j]);
						if(v<0)
						{
							v=-v;
							t[0]=161;
						}else  t[0]=162;
    
						t[5]=(v%10)+150; v=v/10;
						t[4]=160;//.
						t[3]=(v%10)+150; v=v/10;
						t[2]=(v%10)+150; v=v/10;
						t[1]=(v%10)+150; v=v/10;

						for(i=0;i<6;i++)
						{
							pOld = memDC.SelectObject(theApp.fillbitmap[t[i]]);
							if (pOld == NULL)return;     // destructors will clean up
							dc.BitBlt(m_rectClient.left+408+i*8+j*64, m_rectClient.top+42, m_rectClient.Width(), m_rectClient.Height(),
								&memDC, 0, 0, SRCCOPY);
							memDC.SelectObject(pOld);
						}
					}//if
			}//for
	}



	if(theApp.lTESTfg!=0)
	{

	}


	if(flash==0)
	{
			SetTimer (200,1000,NULL);	
	}
	flash=0xff;

    flash_face=0;

	// Do not call CStatic::OnPaint() for painting messages
}

void CCurveData::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
    flash_face=0xaa;
    Invalidate(true);	

	CStatic::OnTimer(nIDEvent);
}

int CCurveData::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CStatic::OnCreate(lpCreateStruct) == -1)
		return -1;
	// TODO: Add your specialized creation code here
	return 0;
}

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

BOOL CCurveData::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) 
{
	// TODO: Add your specialized code here and/or call the base class
//  SetTimer (200,1000,NULL);	
//	AfxMessageBox(_T("123"));
	
	return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}

void CCurveData::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
    flash=0;	
//	SetTimer (200,10,NULL);	
	CStatic::OnLButtonDown(nFlags, point);
}

⌨️ 快捷键说明

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