📄 adraw.cpp
字号:
// ADraw.cpp : implementation file
//
#include "stdafx.h"
#include "item4.h"
#include "ADraw.h"
#include "DATA.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CADraw dialog
CADraw::CADraw(CWnd* pParent /*=NULL*/)
: CDialog(CADraw::IDD, pParent)
{
//{{AFX_DATA_INIT(CADraw)
m_a = 0.0f;
m_q = _T("");
//}}AFX_DATA_INIT
}
void CADraw::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CADraw)
DDX_Text(pDX, IDC_EDIT1, m_a);
DDX_Text(pDX, IDC_STATIC11, m_q);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CADraw, CDialog)
//{{AFX_MSG_MAP(CADraw)
ON_BN_CLICKED(IDC_BUTTON_DREW, OnButtonDrew)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CADraw message handlers
void CADraw::GetTableNameAndID(CString str,int i)
{
this->mData.SetmTableName(str);
this->mID=i;
}
void CADraw::OnButtonDrew()
{
CString name;
switch(this->mID)
{
case 0:name="A路频率图";break;
case 1:name="B路频率图";break;
case 2:name="两路频率差图";break;
}
this->GetActiveWindow()->SetWindowText(name);
this->DrawCoodinate();
CClientDC pDC(this);
CPen SolidPen(PS_SOLID,1,RGB(255,0,0));
pDC.SelectObject(&SolidPen);
this->mData.SetmGetNumAndmNum(0,this->mID);
POINT poi=this->mData.GetPoint(this->mID);
pDC.MoveTo(poi.x,poi.y);
for(int i=1;i<this->mPointNum;i++)
{
this->mData.SetmGetNumAndmNum(i,this->mID);
poi=this->mData.GetPoint(this->mID);
pDC.LineTo(poi.x,poi.y);
}
// TODO: Add your control notification handler code here
}
void CADraw::DrawCoodinate()
{
this->UpdateData();
this->mData.SetmAccurateData(this->m_a);
this->mData.SetmPointNum();
this->mPointNum=this->mData.GetXLong();
CClientDC pDC(this); // device context for painting
pDC.MoveTo(70,250);
pDC.LineTo(800,250);
pDC.LineTo(790,240);
pDC.MoveTo(800,250);
pDC.LineTo(790,260);
pDC.MoveTo(70,450);
pDC.LineTo(70,50);
pDC.LineTo(60,60);
pDC.MoveTo(70,50);
pDC.LineTo(80,60);
CString ss;
ss.Format("%.2f",this->m_a);
pDC.TextOut(5,250,ss);
float temp;
if(this->mID<2)
temp=0.05;
else
temp=0.1;
ss.Format("%.2f",this->m_a+temp);
pDC.TextOut(5,70,ss);
ss.Format("%.2f",this->m_a-temp);
pDC.TextOut(5,430,ss);
ss.Format("%d",this->mPointNum);
pDC.TextOut(780,260,ss);
pDC.TextOut(785,220,"采集点数");
pDC.MoveTo(780,250);
pDC.LineTo(780,244);
CPen myPen,*pCPen;
myPen.CreatePen(1,1,RGB(0,0,255));
pCPen=pDC.SelectObject(&myPen);
pDC.MoveTo(70,70);
pDC.LineTo(800,70);
pDC.MoveTo(70,430);
pDC.LineTo(800,430);
pDC.SelectObject(pCPen);
myPen.DeleteObject();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -