資源簡介
簡易PC虛擬串口示波器,包含VC++整個工程源碼,信號由串口輸入,可有proteus仿真輸入信號來測試。

代碼片段和文件信息
//?Scope1.cpp?:?implementation?file
//
#include?“stdafx.h“
#include?“resource.h“
#include?“Scope.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CScope
CScope::CScope()
{
m_strtitle?=?_T(“示波器“);
m_strValueName?=?_T(“數值“);
m_strUnitName?=?_T(“度“);
m_BkBrush.CreateSolidBrush(RGB(0x000x000x33));
m_PanelBrush.CreateSolidBrush(RGB(0x220x220x44));
m_CurveBrush.CreateSolidBrush(RGB(0x000x000x00));
m_PenCurve.CreatePen(PS_SOLID2RGB(02550));
m_PenGrid.CreatePen(PS_SOLID0RGB(192192192));
m_PenBrightLine.CreatePen(PS_SOLID0RGB(0xff0xff0xff));
m_PenDarkLine.CreatePen(PS_SOLID0RGB(0x550x550x55));
m_Fonttitle.CreateFont(18000FW_BOLDFALSEFALSEFALSEDEFAULT_CHARSET
OUT_DEFAULT_PRECISCLIP_DEFAULT_PRECISDEFAULT_QUALITYDEFAULT_PITCH“宋體“);
m_FontAxis.CreateFont(15000FW_THINFALSEFALSEFALSEDEFAULT_CHARSET
OUT_DEFAULT_PRECISCLIP_DEFAULT_PRECISDEFAULT_QUALITYDEFAULT_PITCH“Arial“);
m_FontValue.CreatePointFont(120“FixedSys“);
m_FontLabel.CreatePointFont(120“Times?New?Roman“);
m_bitmaptitle.LoadBitmap(IDB_title);
m_bitmapTrack.LoadBitmap(IDB_TRACK);
m_dDimT =?1.0;
m_dDimY =?2.5;
m_nbase?=?5;
m_nRange?=?10;
m_dValue=?0.0;
m_nArrowIndex?=-1;
m_bPressed?=?FALSE;
}
CScope::~CScope()
{
if(!m_TimeList.empty())
m_TimeList.clear();
if(!m_ValueList.empty())
m_ValueList.clear();
}
BEGIN_MESSAGE_MAP(CScope?CStatic)
//{{AFX_MSG_MAP(CScope)
ON_WM_ERASEBKGND()
ON_WM_PAINT()
ON_WM_LBUTTONUP()
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
ON_WM_NCHITTEST()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CScope?message?handlers
BOOL?CScope::OnEraseBkgnd(CDC*?pDC)?
{
//?TODO:?Add?your?message?handler?code?here?and/or?call?default
CRect?rect;
GetClientRect(&rect);
pDC->FillRect(&rect&m_BkBrush);//Draw?background
rect.InflateRect(-3-25-4-60);//curve?panel
m_rectCurvePanel?=?rect;
m_rectCurve?=?rect;
m_rectCurve.InflateRect(-30-5-23-25);//curve?area
m_rectScroll?=?m_rectCurve;
m_rectScroll.left?=?m_rectCurve.right+8;
m_rectScroll.right?=?m_rectScroll.left+10;//rect?scroll?created
m_rectValuePanel?=?rect;
m_rectValuePanel.top?=?rect.bottom+5;
m_rectValuePanel.bottom=?m_rectValuePanel.top+51;//rectValuePanel?created
CFont?*pOldFont;
pOldFont?=?pDC->Selectobject(&m_FontLabel);
CSize?size?=?pDC->GetTextExtent(m_strValueName);
m_rectValue.left?=?m_rectValuePanel.left+20+size.cx;
m_rectValue.top?=?m_rectValuePanel.top+(m_rectValuePanel.Height()-size.cy)/2-2;
m_rectValue.bottom?=?m_rectValue.top+size.cy+4;
size?=?pDC->GetTextExtent(m_strUnitName);
m_rectValue.right?=?m_rectValuePanel.right?-?20?-?size.cx;
pDC->Selectobject(pOldFont);
if(m_rgnCurve.m_hobject==NULL)
m_rgnCurve.C
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????28672??2011-09-19?13:59??SerialPortTest\C++.IAB
?????文件????????608??2011-09-19?13:59??SerialPortTest\C++.IAD
?????文件???????8192??2011-09-19?13:59??SerialPortTest\C++.IMB
?????文件????????408??2011-09-19?13:59??SerialPortTest\C++.IMD
?????文件?????????64??2011-09-21?10:24??SerialPortTest\C++.PFI
?????文件????????776??2011-09-21?10:24??SerialPortTest\C++.PO
?????文件???????5504??2011-09-19?13:59??SerialPortTest\C++.PR
?????文件??????32896??2011-09-19?13:59??SerialPortTest\C++.PRI
?????文件??????53316??2011-09-21?10:24??SerialPortTest\C++.PS
?????文件????????256??2011-09-19?20:35??SerialPortTest\C++.SearchResults
?????文件??????18460??2012-05-31?10:25??SerialPortTest\C++.WK3
?????文件??????11114??2011-03-24?12:58??SerialPortTest\Debug\BuildLog.htm
?????文件??????98840??2011-04-08?19:57??SerialPortTest\Debug\Scope.obj
?????文件??????26555??2011-05-28?15:05??SerialPortTest\Debug\SerialPort.obj
?????文件??????????0??2011-05-28?15:05??SerialPortTest\Debug\SerialPort.sbr
?????文件????5366784??2011-09-19?15:26??SerialPortTest\Debug\SerialPortTest.bsc
?????文件?????135233??2011-09-19?15:26??SerialPortTest\Debug\SerialPortTest.exe
?????文件???????2048??2011-03-24?12:58??SerialPortTest\Debug\SerialPortTest.exe.em
?????文件?????333952??2011-09-19?15:26??SerialPortTest\Debug\SerialPortTest.ilk
?????文件??????33306??2011-05-28?15:05??SerialPortTest\Debug\SerialPortTest.obj
?????文件???????3800??2011-05-28?15:05??SerialPortTest\Debug\SerialPortTest.res
?????文件??????????0??2011-05-28?15:05??SerialPortTest\Debug\SerialPortTest.sbr
?????文件??????84156??2011-09-19?15:26??SerialPortTest\Debug\SerialPortTestDlg.obj
?????文件??????????0??2011-09-19?15:26??SerialPortTest\Debug\SerialPortTestDlg.sbr
?????文件?????105532??2011-05-28?15:05??SerialPortTest\Debug\StdAfx.obj
?????文件????1373432??2011-05-28?15:05??SerialPortTest\Debug\StdAfx.sbr
?????文件??????13368??2011-09-19?15:26??SerialPortTest\Debug\TestBtn.obj
?????文件??????????0??2011-09-19?15:26??SerialPortTest\Debug\TestBtn.sbr
?????文件?????238592??2011-09-19?15:26??SerialPortTest\Debug\vc60.idb
?????文件?????397312??2011-09-19?15:26??SerialPortTest\Debug\vc60.pdb
............此處省略46個文件信息
- 上一篇:小型CAD系統MFC實現
- 下一篇:MFC繪圖程序,實現繪圖中的各種形式。
評論
共有 條評論