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

📄 dlgalarmerview.cpp

📁 串口收发工具
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// DlgAlarmerView.cpp : implementation file
//

#include "stdafx.h"
#include "maintain.h"
#include "DlgAlarmerView.h"
#include "MainFrm.h"
#include <atlbase.h>



#include "MenuExt.h"



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

/////////////////////////////////////////////////////////////////////////////
// CDlgAlarmerView

IMPLEMENT_DYNCREATE(CDlgAlarmerView, CFrameWnd)

CDlgAlarmerView::CDlgAlarmerView()
{
}

CDlgAlarmerView::~CDlgAlarmerView()
{
}


BEGIN_MESSAGE_MAP(CDlgAlarmerView, CFrameWnd)
	//{{AFX_MSG_MAP(CDlgAlarmerView)
	ON_WM_DESTROY()
	ON_WM_PAINT()
	ON_COMMAND(IDR_AlarmerV_QU, OnAlarmerVQU)
	ON_WM_CREATE()
	ON_COMMAND(IDR_AlarmerV_P1, OnAlarmerVP1)
	ON_COMMAND(IDR_AlarmerV_P2, OnAlarmerVP2)
	ON_COMMAND(IDR_AlarmerV_P3, OnAlarmerVP3)
	ON_COMMAND(IDR_AlarmerV_P4, OnAlarmerVP4)
	ON_COMMAND(IDR_AlarmerV_P5, OnAlarmerVP5)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgAlarmerView message handlers

void CDlgAlarmerView::OnDestroy() 
{
	CFrameWnd::OnDestroy();
	
//	bShowData = true;
//	m_font.DeleteObject();
	((CMainFrame*)AfxGetMainWnd())->bAlarm_InfWndShow=false;
}

void CDlgAlarmerView::OnPaint() 
{
	CPaintDC dc(this); // device context for painting	
	HDC hDC = dc.GetSafeHdc();
		char temp[100];
	int nWidth = 22 ;
	int nHeight = 24;

	GetClientRect(rect);

	int nX = 30;
	int nY = 30;
	switch(query_flag)
	{
	case 1:
		strcpy(temp,"查询状态:失败");
		break;
	case 2:
		strcpy(temp,"查询状态:成功");
		break;
	default:
		strcpy(temp,"查询状态:失败");
		break;
	}

	TextOut(hDC,nX+500,450,temp,strlen(temp));
	ShowGroup(hDC);

}
void CDlgAlarmerView::ShowGroup(HDC hDC)
{
	switch(m_fGroupFirstPage)
	{
	case 1:
		SixthGroupDC(hDC);
		break;
	case 2:
		SecondGroupDC(hDC);	
		break;
	case 3:
		ThirdGroupDC(hDC);
		break;
	case 4:
		FourthGroupDC(hDC);
		break;
	case 5:
		FifthGroupDC(hDC);
		break;
	default:
		SixthGroupDC(hDC);
		break;
	}
}

void CDlgAlarmerView::SecondGroupDC(HDC hDC)
{
	char temp[100];
	int nWidth = 22 ;
	int nHeight = 24;

	GetClientRect(rect);

	int nX = 30;
	int nY = 30;

	//标题栏的显示
	strcpy(temp,"防区与告警输入对应关系----上");
	TextOut(hDC,nX+300,0,temp,strlen(temp));
	strcpy(temp,"报警输入号→");
	TextOut(hDC,nX,13,temp,strlen(temp));
	strcpy(temp,"防");
	TextOut(hDC,13,30,temp,strlen(temp));
	strcpy(temp,"区");
	TextOut(hDC,13,45,temp,strlen(temp));
	strcpy(temp,"号");
	TextOut(hDC,13,60,temp,strlen(temp));
	strcpy(temp,"↓");
	TextOut(hDC,13,75,temp,strlen(temp));
	strcpy(temp,"第2页");
	TextOut(hDC,nX+300,485,temp,strlen(temp));

	// 表格外框架线条的生成
	rect.SetRect(nX,nY,nX+33*nWidth+2,nY+17*nHeight+2);
	DrawRect(hDC,rect,RGB(128,128,128));
	rect.DeflateRect(1,1);
	DrawRect(hDC,rect,RGB(0,0,0));
	rect.DeflateRect(1,1);
	DrawRect(hDC,rect,RGB(192,192,192));

	for(int i=0;i<32;i++)
	{
		DrawLine(hDC,rect.left+(i+1)*nWidth,rect.top,rect.left+(i+1)*nWidth,rect.bottom,RGB(128,128,128));
	}
	for(i=0;i<16;i++)
	{
		DrawLine(hDC,rect.left,rect.top+(i+1)*nHeight,rect.right,rect.top+(i+1)*nHeight,RGB(128,128,128));
	}
	for(i=0;i<16;i++)
	{
		sprintf(temp,"%d",i+1);
		TextOut(hDC,36,36+(i+1)*nHeight,temp,strlen(temp));
	}
	for(int j=0;j<16;j++)
	{
		DWORD dwtemp=((GroupStation.Alarm_Area[j]&0xff)<<24)+((GroupStation.Alarm_Area[j]&0xff00)<<8)
			+((GroupStation.Alarm_Area[j]&0xff0000)>>8)+((GroupStation.Alarm_Area[j]&0xff000000)>>24);
		for(i=0;i<32;i++)
		{
			if (dwtemp & 0x01)
			{
				strcpy(temp,"√");
				TextOut(hDC,36+(i+1)*nWidth,36+(j+1)*nHeight,temp,strlen(temp));
			}
			dwtemp >>= 1;
		}
	}
	DWORD dwtemp=((GroupStation.Alarm32s_Enable&0xff)<<24)+((GroupStation.Alarm32s_Enable&0xff00)<<8)
			+((GroupStation.Alarm32s_Enable&0xff0000)>>8)+((GroupStation.Alarm32s_Enable&0xff000000)>>24);
	for(i=0;i<32;i++)
	{
		if (dwtemp & 0x01) SetTextColor(hDC,RGB(0,0,255));
		else SetTextColor(hDC,RGB(192,192,192));
		sprintf(temp,"%d",i+1);
		TextOut(hDC,36+(i+1)*nWidth,36,temp,strlen(temp));
		dwtemp >>= 1;
	}
}

void CDlgAlarmerView::ThirdGroupDC(HDC hDC)
{

	char temp[100];
	int nWidth = 22 ;
	int nHeight = 24;

	GetClientRect(rect);

	int nX = 30;
	int nY = 30;

	//标题栏的显示
	strcpy(temp,"防区与告警输入对应关系----下");
	TextOut(hDC,nX+300,0,temp,strlen(temp));
	strcpy(temp,"报警输入号→");
	TextOut(hDC,nX,13,temp,strlen(temp));
	strcpy(temp,"防");
	TextOut(hDC,13,30,temp,strlen(temp));
	strcpy(temp,"区");
	TextOut(hDC,13,45,temp,strlen(temp));
	strcpy(temp,"号");
	TextOut(hDC,13,60,temp,strlen(temp));
	strcpy(temp,"↓");
	TextOut(hDC,13,75,temp,strlen(temp));
	strcpy(temp,"第3页");
	TextOut(hDC,nX+300,485,temp,strlen(temp));
	// 表格外框架线条的生成
	rect.SetRect(nX,nY,nX+33*nWidth+2,nY+17*nHeight+2);
	DrawRect(hDC,rect,RGB(128,128,128));
	rect.DeflateRect(1,1);
	DrawRect(hDC,rect,RGB(0,0,0));
	rect.DeflateRect(1,1);
	DrawRect(hDC,rect,RGB(192,192,192));

	for(int i=0;i<32;i++)
	{
		DrawLine(hDC,rect.left+(i+1)*nWidth,rect.top,rect.left+(i+1)*nWidth,rect.bottom,RGB(128,128,128));
	}
	for(i=0;i<16;i++)
	{
		DrawLine(hDC,rect.left,rect.top+(i+1)*nHeight,rect.right,rect.top+(i+1)*nHeight,RGB(128,128,128));
	}
	for(i=0;i<16;i++)
	{
		sprintf(temp,"%d",i+17);
		TextOut(hDC,36,36+(i+1)*nHeight,temp,strlen(temp));
	}
	for(int j=0;j<16;j++)
	{
		DWORD dwtemp=((GroupStation.Alarm_Area[j+16]&0xff)<<24)+((GroupStation.Alarm_Area[j+16]&0xff00)<<8)
			+((GroupStation.Alarm_Area[j+16]&0xff0000)>>8)+((GroupStation.Alarm_Area[j+16]&0xff000000)>>24);
		for(i=0;i<32;i++)
		{
			if (dwtemp & 0x01)
			{
				strcpy(temp,"√");
				TextOut(hDC,36+(i+1)*nWidth,36+(j+1)*nHeight,temp,strlen(temp));
			}
			dwtemp >>= 1;
		}
	}
	DWORD dwtemp=((GroupStation.Alarm32s_Enable&0xff)<<24)+((GroupStation.Alarm32s_Enable&0xff00)<<8)
			+((GroupStation.Alarm32s_Enable&0xff0000)>>8)+((GroupStation.Alarm32s_Enable&0xff000000)>>24);
	for(i=0;i<32;i++)
	{
		if (dwtemp & 0x01) SetTextColor(hDC,RGB(0,0,255));
		else SetTextColor(hDC,RGB(192,192,192));
		sprintf(temp,"%d",i+1);
		TextOut(hDC,36+(i+1)*nWidth,36,temp,strlen(temp));
		dwtemp >>= 1;
	}
}

void CDlgAlarmerView::FourthGroupDC(HDC hDC)
{
	char temp[100];
	int nWidth = 22 ;
	int nHeight = 24;

	GetClientRect(rect);

	int nX = 30;
	int nY = 30;

	//标题栏的显示
	strcpy(temp,"遥控输出与告警输入对应关系----上");
	TextOut(hDC,nX+300,0,temp,strlen(temp));
	strcpy(temp,"报警输入号→");
	TextOut(hDC,nX,13,temp,strlen(temp));
	strcpy(temp,"遥");
	TextOut(hDC,13,30,temp,strlen(temp));
	strcpy(temp,"控");
	TextOut(hDC,13,45,temp,strlen(temp));
	strcpy(temp,"输");
	TextOut(hDC,13,60,temp,strlen(temp));
	strcpy(temp,"出");
	TextOut(hDC,13,75,temp,strlen(temp));
	strcpy(temp,"号");
	TextOut(hDC,13,90,temp,strlen(temp));
	strcpy(temp,"↓");
	TextOut(hDC,13,105,temp,strlen(temp));
	strcpy(temp,"第4页");
	TextOut(hDC,nX+300,485,temp,strlen(temp));

	// 表格外框架线条的生成
	rect.SetRect(nX,nY,nX+33*nWidth+2,nY+17*nHeight+2);
	DrawRect(hDC,rect,RGB(128,128,128));
	rect.DeflateRect(1,1);
	DrawRect(hDC,rect,RGB(0,0,0));
	rect.DeflateRect(1,1);
	DrawRect(hDC,rect,RGB(192,192,192));

	for(int i=0;i<32;i++)
	{
		DrawLine(hDC,rect.left+(i+1)*nWidth,rect.top,rect.left+(i+1)*nWidth,rect.bottom,RGB(128,128,128));
	}
	for(i=0;i<16;i++)
	{
		DrawLine(hDC,rect.left,rect.top+(i+1)*nHeight,rect.right,rect.top+(i+1)*nHeight,RGB(128,128,128));
	}
	for(i=0;i<16;i++)
	{
		sprintf(temp,"%d",i+1);
		TextOut(hDC,36,36+(i+1)*nHeight,temp,strlen(temp));
	}
	for(int j=0;j<16;j++)
	{
		DWORD dwtemp=((GroupStation.Node_Out[j]&0xff)<<24)+((GroupStation.Node_Out[j]&0xff00)<<8)
			+((GroupStation.Node_Out[j]&0xff0000)>>8)+((GroupStation.Node_Out[j]&0xff000000)>>24);
		for(i=0;i<32;i++)
		{
			if (dwtemp & 0x01)
			{
				strcpy(temp,"√");
				TextOut(hDC,36+(i+1)*nWidth,36+(j+1)*nHeight,temp,strlen(temp));
			}
			dwtemp >>= 1;

⌨️ 快捷键说明

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