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

📄 dataprocessdlg.cpp

📁 串行通讯程序,为电池分析仪与电脑通讯软件,效果不错.
💻 CPP
字号:
// DataProcessDlg.cpp : implementation file
//

#include "stdafx.h"
#include "DigitalPowerAnalyst.h"
#include "DataProcessDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDataProcessDlg dialog


CDataProcessDlg::CDataProcessDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CDataProcessDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDataProcessDlg)
		// NOTE: the ClassWizard will add member initialization here
		IsDlgShow=FALSE;
	//}}AFX_DATA_INIT
}


void CDataProcessDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDataProcessDlg)
	DDX_Control(pDX, IDC_StaticDataDisplay0, m_StaticDataDisp);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDataProcessDlg, CDialog)
	//{{AFX_MSG_MAP(CDataProcessDlg)
	ON_BN_CLICKED(IDC_BNInit, OnBNInit)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDataProcessDlg message handlers

BOOL CDataProcessDlg::OnInitDialog() 
{

	CDialog::OnInitDialog();

	// TODO: Add extra initialization here
	//Inint();
	      WriteGrid(&m_StaticDataDisp);	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
void  CDataProcessDlg::WriteGrid(CStatic * m_Static)
{
	CBrush m_Brush;
	CPen pen;
	pen.CreatePen(PS_SOLID,1,RGB(0,0,0));
	m_Brush.CreateSolidBrush(RGB(0, 0, 0));
	CClientDC* pDC=new CClientDC(m_Static);//&m_StaticPicture);&m_StaticDataDisp
	CPen * oldPen=(CPen*)pDC->SelectObject(&pen);
 	CBrush * oldBrush=(CBrush*) pDC->SelectObject(&m_Brush);
	CString tmpStr;
    CRect rect;
	m_Static->GetClientRect(&rect);
	int nBottom=rect.bottom;
	int nTop=rect.top;
	int nLeft=rect.left ;
	int nRight=rect.right ;
	for(int i=0;i<9;i++)
	{
	pDC->MoveTo(nLeft+(nRight-nLeft)*i/8,nTop);
	pDC->LineTo(nLeft+(nRight-nLeft)*i/8,nBottom);//nTop+(nBottom-nTop)*i/8
	pDC->MoveTo(nLeft,nTop+(nBottom-nTop)*i/8);
	pDC->LineTo(nRight,nTop+(nBottom-nTop)*i/8);
	//tmpStr.Format("%5d",rect.bottom);
	//pDC->TextOut( pt[i].x, pt[i].y,tmpStr);
	}
}

void CDataProcessDlg::Inint()
{
      WriteGrid(&m_StaticDataDisp);	
	  this->RedrawWindow();
	  this->UpdateData(FALSE);
	  this->GetParentFrame()->GetParentOwner();
}

int CDataProcessDlg::DoModal() 
{
	// TODO: Add your specialized code here and/or call the base class

	return CDialog::DoModal();
}

void CDataProcessDlg::OnBNInit() 
{
	// TODO: Add your control notification handler code here
	    WriteGrid(&m_StaticDataDisp);
}

void CDataProcessDlg::OnOK() 
{
	// TODO: Add extra validation here
 	IsDlgShow=FALSE;
	CDialog::OnOK();
}







⌨️ 快捷键说明

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