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

📄 dlg05.cpp

📁 DSP图像处理程序源码
💻 CPP
字号:
// Dlg05.cpp : implementation file
//

#include "stdafx.h"
#include "DSP.h"
#include "Dlg05.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDlg05 dialog


CDlg05::CDlg05(CWnd* pParent /*=NULL*/)
	: CDialog(CDlg05::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlg05)
	m_sgn = _T("");
	m_N = 0;
	//}}AFX_DATA_INIT
}


void CDlg05::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlg05)
	DDX_Control(pDX, IDC_MSFLEXGRID1, m_grid);
	DDX_Text(pDX, IDC_EDIT1, m_sgn);
	DDX_Text(pDX, IDC_EDIT2, m_N);
	DDV_MinMaxInt(pDX, m_N, 1, 12);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlg05, CDialog)
	//{{AFX_MSG_MAP(CDlg05)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlg05 message handlers

void CDlg05::OnButton1() 
{
	// TODO: Add your control notification handler code here
	UpdateData();
	int i;
	int N;
	N=pow(2,m_N);
	sgntemp.CStringToSignal(m_sgn);
	sgntemp.fitForLen(N);
	CDC* pDC = GetDC();
	m_grid.SetRows(3);
	m_grid.SetCols(sgntemp.length+1);
	for (i=1;i<=N;i++)
	{
		m_grid.SetColWidth ( i,( long ) ( 144 * 1440.0 / pDC->GetDeviceCaps(LOGPIXELSX) ) );
	}
	
	m_grid.SetTextMatrix(1,0,"Time");
	m_grid.SetTextMatrix(2,0,"Freq");
	sgntemp.FFT();
	CString str;
	CString str1;
	for (i=0;i<sgntemp.length;i++)
	{	str.Format("%d",i+1);
		m_grid.SetTextMatrix(0,i+1,str);
		str.Empty();
		str.Format("%4.4f",sgntemp.sgnt[i]);
		m_grid.SetTextMatrix(1,i+1,str);
		str.Empty();
		str1.Empty();
		str.Format("%4.4f",sgntemp.sgnw[i].real);
		str1.Format("%4.4f",sgntemp.sgnw[i].imag);
		if (sgntemp.sgnw[i].imag>0)
			str=str+'+'+str1+'i';
		else
			str=str+str1+'i';
		m_grid.SetTextMatrix(2,i+1,str);
	}
	
	UpdateData(FALSE);
}

void CDlg05::OnCancel() 
{
	// TODO: Add extra cleanup here
	MessageBox("真的要退出吗?");
	CDialog::OnCancel();
}

void CDlg05::OnOK() 
{
	// TODO: Add extra validation here
	sgn.FreqChangeToTime(sgntemp);
	drawdiscrete=FALSE;
	CDialog::OnOK();
}

⌨️ 快捷键说明

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