📄 wavedlg.cpp
字号:
// WaveDlg.cpp : implementation file
//
#include "stdafx.h"
#include "串口调试.h"
#include "WaveDlg.h"
#include "串口调试Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWaveDlg dialog
CWaveDlg::CWaveDlg(CWnd* pParent /*=NULL*/)
: CDialog(CWaveDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CWaveDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CWaveDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CWaveDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CWaveDlg, CDialog)
//{{AFX_MSG_MAP(CWaveDlg)
ON_WM_CLOSE()
ON_WM_SIZE()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWaveDlg message handlers
void CWaveDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
DestroyWindow();
CDialog::OnClose();
}
void CWaveDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
m_WaveWndW = cx;
m_WaveWndH = cy;
Invalidate();
// TODO: Add your message handler code here
}
void CWaveDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
dc.MoveTo(10,10);
dc.LineTo(10,m_WaveWndH-20);
dc.MoveTo(10,m_WaveWndH-20);
dc.LineTo(m_WaveWndW-10,m_WaveWndH-20);
for(int i=0;i<(int)strlen(m_ReceiveBuffer)-1;i++)
{
dc.MoveTo(
i*10+10,
m_WaveWndH-(int)(m_ReceiveBuffer.GetAt(i))*(m_WaveWndH-20)/256-10
);
dc.LineTo(
(i+2)*10,
m_WaveWndH-(int)(m_ReceiveBuffer.GetAt(i+1))*(m_WaveWndH-20)/256-10
);
}
((CScrollBar*)GetDlgItem(IDC_SCROLLBAR))->SetScrollPos(100,FALSE);
// TODO: Add your message handler code here
// Do not call CDialog::OnPaint() for painting messages
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -