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

📄 newdlg0.cpp

📁 这个我写的一个计算LC滤波器的程序
💻 CPP
字号:
// NewDlg0.cpp : implementation file
//

#include "stdafx.h"
#include "Fileter.h"
#include "NewDlg0.h"

#include "math.h"

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

/////////////////////////////////////////////////////////////////////////////
// CNewDlg0 dialog


CNewDlg0::CNewDlg0(CWnd* pParent /*=NULL*/)
	: CDialog(CNewDlg0::IDD, pParent)
{
	//{{AFX_DATA_INIT(CNewDlg0)
	m_FirstVal = 0.0;
	m_TwoVal = 0.0;
	m_RL = 0.0;
	//}}AFX_DATA_INIT
	m_Class= CAUER;
	m_Type= MYLPF;
	m_TypeF1= MHZ;
	m_TypeF2= MHZ;
}


void CNewDlg0::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CNewDlg0)
	DDX_Control(pDX, IDC_TYPE_COMBO, m_TypeCtrl);
	DDX_Control(pDX, IDC_TWO_COMBO, m_TwoCtrl);
	DDX_Control(pDX, IDC_FIRST_COMBO, m_FirstCtrl);
	DDX_Control(pDX, IDC_CLASS_COMBO, m_ClassCtrl);
	DDX_Text(pDX, IDC_FIRST_EDIT, m_FirstVal);
	DDV_MinMaxDouble(pDX, m_FirstVal, 1., 10000000000.);
	DDX_Text(pDX, IDC_TWO_EDIT, m_TwoVal);
	DDV_MinMaxDouble(pDX, m_TwoVal, 1., 10000000000.);
	DDX_Text(pDX, IDC_RL_EDIT, m_RL);
	DDV_MinMaxDouble(pDX, m_RL, 0., 99999.);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CNewDlg0, CDialog)
	//{{AFX_MSG_MAP(CNewDlg0)
	ON_CBN_SELCHANGE(IDC_CLASS_COMBO, OnSelchangeClassCombo)
	ON_CBN_SELCHANGE(IDC_TYPE_COMBO, OnSelchangeTypeCombo)
	ON_CBN_SELCHANGE(IDC_FIRST_COMBO, OnSelchangeFirstCombo)
	ON_CBN_SELCHANGE(IDC_TWO_COMBO, OnSelchangeTwoCombo)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CNewDlg0 message handlers

BOOL CNewDlg0::OnInitDialog() 
{
	CDialog::OnInitDialog();
	// TODO: Add extra initialization here
	m_ClassCtrl.SetCurSel(m_Class);
	m_TypeCtrl.SetCurSel(m_Type);
	m_FirstCtrl.SetCurSel(m_TypeF1);
	m_TwoCtrl.SetCurSel(m_TypeF2);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
void CNewDlg0::SetValToDlg(int Class,int Type,double FirstVal,double TwoVal,double RL)
{	
	m_Class=Class;
	m_Type=Type;
// the F1 value
	if(FirstVal>=1e6)
	{
		m_FirstVal=FirstVal/1e6;
		m_TypeF1=MHZ;
	}
	else if(FirstVal>=1e3)
	{
		m_FirstVal=FirstVal/1e3;
		m_TypeF1=KHZ;
	}
	else 
	{
		m_FirstVal=FirstVal;
		m_TypeF1=HZ;
	}
// the F2 value
	if(TwoVal>=1e6)
	{
		m_TwoVal=TwoVal/1e6;
		m_TypeF2=MHZ;
	}
	else if(TwoVal>=1e3)
	{
		m_TwoVal=TwoVal/1e3;
		m_TypeF2=KHZ;
	}
	else 
	{
		m_TwoVal=TwoVal;
		m_TypeF2=HZ;
	}

	m_RL=RL;
}

void CNewDlg0::GetValFromDlg(int &Class,int &Type,double &FirstVal,double &TwoVal,double &RL)
{
	Class=m_Class;
	Type=m_Type;
	FirstVal=m_FirstVal*pow(10.0,m_TypeF1*3);
	TwoVal=m_TwoVal*pow(10.0,m_TypeF2*3);
	RL=m_RL;
}

void CNewDlg0::OnSelchangeClassCombo() 
{
	// TODO: Add your control notification handler code here
	m_Class=m_ClassCtrl.GetCurSel();
}

void CNewDlg0::OnSelchangeTypeCombo() 
{
	// TODO: Add your control notification handler code here
	m_Type=m_TypeCtrl.GetCurSel();
}

void CNewDlg0::OnSelchangeFirstCombo() 
{
	// TODO: Add your control notification handler code here
	m_TypeF1=m_FirstCtrl.GetCurSel();
}

void CNewDlg0::OnSelchangeTwoCombo() 
{
	// TODO: Add your control notification handler code here
	m_TypeF2=m_TwoCtrl.GetCurSel();
}

⌨️ 快捷键说明

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