?? dlg09.cpp
字號:
// Dlg09.cpp : implementation file
//
#include "stdafx.h"
#include "DSP.h"
#include "Dlg09.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlg09 dialog
CDlg09::CDlg09(CWnd* pParent /*=NULL*/)
: CDialog(CDlg09::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlg09)
m_zero = _T("");
m_top = _T("");
m_currentposition = _T("");
m_pointstyle = 0;
//}}AFX_DATA_INIT
centre.x=300;
centre.y=200;
}
void CDlg09::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlg09)
DDX_Text(pDX, IDC_EDIT1, m_zero);
DDX_Text(pDX, IDC_EDIT2, m_top);
DDX_Text(pDX, IDC_EDIT3, m_currentposition);
DDX_Radio(pDX, IDC_RADIO1, m_pointstyle);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlg09, CDialog)
//{{AFX_MSG_MAP(CDlg09)
ON_WM_PAINT()
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONDOWN()
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlg09 message handlers
void CDlg09::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
dc.Ellipse(centre.x-160,centre.y-160,centre.x+160,centre.y+160);
dc.MoveTo(centre.x-180,centre.y);
dc.LineTo(centre.x+180,centre.y);
dc.MoveTo(centre.x,centre.y-180);
dc.LineTo(centre.x,centre.y+180);
CPoint point;
int i;
for (i=0;i<zplat.zero.length;i++)
{
point.x=(int)(zplat.zero.sgnw[i].real*160)+centre.x;
point.y=-(int)(zplat.zero.sgnw[i].imag*160)+centre.y;
dc.Ellipse(point.x-3,point.y-3,point.x+3,point.y+3);
}
for (i=0;i<zplat.top.length;i++)
{
point.x=(int)(zplat.top.sgnw[i].real*160)+centre.x;
point.y=-(int)(zplat.top.sgnw[i].imag*160)+centre.y;
dc.MoveTo(point.x+3,point.y+3);
dc.LineTo(point.x-3,point.y-3);
dc.MoveTo(point.x-3,point.y+3);
dc.LineTo(point.x+3,point.y-3);
}
// Do not call CDialog::OnPaint() for painting messages
}
void CDlg09::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
double x;
double y;
CString str;
x=(point.x-centre.x)/160.0;
y=(-point.y+centre.y)/160.0;
UpdateData();
m_currentposition.Empty();
if (x*x+y*y<=1.0)
{
str.Format("%4.4f",x);
m_currentposition=m_currentposition+str;
m_currentposition=m_currentposition+' ';
str.Format("%4.4f",y);
m_currentposition=m_currentposition+str;
m_currentposition=m_currentposition+'i';
}
UpdateData(FALSE);
CDialog::OnMouseMove(nFlags, point);
}
void CDlg09::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
double x;
double y;
complex comp;
CString str;
x=(point.x-centre.x)/160.0;
y=(-point.y+centre.y)/160.0;
UpdateData();
if (x*x+y*y<=1.0)
{
comp.real=x;
comp.imag=y;
UpdateData();
if (m_pointstyle==0)
{
zplat.InsertZero(comp);
}
else if (x*x+y*y!=1.0)
{
zplat.InsertTop(comp);
}
}
UpdateData(FALSE);
CDialog::OnLButtonDown(nFlags, point);
Invalidate();
}
void CDlg09::OnButton1()
{
// TODO: Add your control notification handler code here
zplat.Empty();
}
void CDlg09::OnButton2()
{
// TODO: Add your control notification handler code here
UpdateData();
m_zero.Empty();
m_top.Empty();
int i;
CString str,str1;
for (i=0;i<zplat.zero.length;i++)
{
str.Empty();
str1.Empty();
str.Format("%4.4f",zplat.zero.sgnw[i].real);
str1.Format("%4.4f",zplat.zero.sgnw[i].imag);
if (zplat.zero.sgnw[i].imag>0)
str=str+'+'+str1+'i';
else
str=str+str1+'i';
m_zero=m_zero+str+' ';
}
for (i=0;i<zplat.top.length;i++)
{
str.Empty();
str1.Empty();
str.Format("%4.4f",zplat.top.sgnw[i].real);
str1.Format("%4.4f",zplat.top.sgnw[i].imag);
if (zplat.top.sgnw[i].imag>0)
str=str+'+'+str1+'i';
else
str=str+str1+'i';
m_top=m_top+str+' ';
}
UpdateData(FALSE);
}
void CDlg09::OnOK()
{
// TODO: Add extra validation here
sgn=zplat.GetAllResponseAbs();
drawdiscrete=FALSE;
CDialog::OnOK();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -