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

📄 jiliangstatewnd.cpp

📁 援非洲刚果共和国电力监控系统VC实现二(测量/计量信息汇总刷新显示)
💻 CPP
字号:
// JiLiangStateWnd.cpp : implementation file
//

#include "stdafx.h"
#include "ybkdemo.h"
#include "JiLiangStateWnd.h"

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

/////////////////////////////////////////////////////////////////////////////
// CJiLiangStateWnd

CJiLiangStateWnd::CJiLiangStateWnd()
{
}

CJiLiangStateWnd::~CJiLiangStateWnd()
{
}


BEGIN_MESSAGE_MAP(CJiLiangStateWnd, CWnd)
	//{{AFX_MSG_MAP(CJiLiangStateWnd)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CJiLiangStateWnd message handlers

BOOL CJiLiangStateWnd::PreCreateWindow(CREATESTRUCT& cs) 
{
	// TODO: Add your specialized code here and/or call the base class
	cs.x = 0;
	cs.y = 0;
	cs.cx = 1024;
	cs.cy = 768;

	InitDeviceRect();
	CreateDevice();

	return CWnd::PreCreateWindow(cs);
}

void CJiLiangStateWnd::InitDeviceRect()
{
	this->m_PartEditRect[0][0].left = 185; this->m_PartEditRect[0][0].top = 163;
	this->m_PartEditRect[0][0].right = 257; this->m_PartEditRect[0][0].bottom = 184;
	for(int i=0;i<14;i++)
	{
		for(int j=0;j<6;j++)
		{
			this->m_PartEditRect[i][j].left = this->m_PartEditRect[0][0].left+89*j; 
			this->m_PartEditRect[i][j].top = this->m_PartEditRect[0][0].top +35*i;
			this->m_PartEditRect[i][j].right = this->m_PartEditRect[0][0].right +89*j; 
			this->m_PartEditRect[i][j].bottom = this->m_PartEditRect[0][0].bottom +35*i;
		}
	}
}

void CJiLiangStateWnd::CreateDevice()
{
	for(int i=0;i<14;i++)
	{
		for(int j=0;j<6;j++)
		{
			this->m_PartEdit[i][j].Create("",WS_CHILD|WS_VISIBLE|WS_BORDER|WS_TABSTOP,this->m_PartEditRect[i][j],AfxGetMainWnd(),2500+i+j);
			this->m_PartEdit[i][j].SetBkColor(BLACK);
			this->m_PartEdit[i][j].SetColor(DARKGREEN,LIGHTGREEN);
			this->m_PartEdit[i][j].SetText("2583.58");
			this->m_PartEdit[i][j].ShowWindow(SW_HIDE);
		}
	}
}

void CJiLiangStateWnd::RefreshMsg()
{
	CString szVal;
	for(int i=0;i<14;i++)
	{
		for(int j=0;j<6;j++)
		{
			this->fVal[i][j] = float(GetRandom(0,100000))/100;
			szVal.Format("%.2f",fVal[i][j]);
			this->m_PartEdit[i][j].SetText(szVal);
		}
	}
}

void CJiLiangStateWnd::ShowDevice(BOOL bShow)
{
	if( bShow )
	{
		for(int i=0;i<14;i++) 
			for(int j=0;j<6;j++)  
				this->m_PartEdit[i][j].ShowWindow(SW_SHOW);  
	}
	else
		{
		for(int i=0;i<14;i++) 
			for(int j=0;j<6;j++)  
				this->m_PartEdit[i][j].ShowWindow(SW_HIDE);  
	}
}

⌨️ 快捷键说明

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