📄 expdlg.cpp
字号:
// expDlg.cpp : implementation file
//
#include "stdafx.h"
#include "exp.h"
#include "expDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExpDlg dialog
CExpDlg::CExpDlg(CWnd* pParent /*=NULL*/)
: CDialog(CExpDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CExpDlg)
m_cb = 0.0f;
m_rc = 0.0f;
m_ubqx = 0.0f;
m_cc = 0.0f;
m_ce = 0.0f;
m_beta = 0.0f;
m_ri = 0.0f;
m_rbb = 0.0f;
m_ucc = 0.0f;
m_icq = 0.0f;
m_au = 0.0f;
m_ubq = 0.0f;
m_re = 0.0f;
m_rb2x = 0.0f;
m_rb2 = 0.0f;
m_rb1 = 0.0f;
m_ibq = 0.0f;
m_rl = 0.0f;
m_cbx = 0.0f;
m_ccx = 0.0f;
m_cex = 0.0f;
m_fl = 0.0f;
m_rs = 0.0f;
re = 0.0f;
rb2 = 0.0f;
rb1 = 0.0f;
rc = 0.0f;
vcc = 0.0f;
vbb = 0.0f;
vceq = 0.0f;
ibq = 0.0f;
icq = 0.0f;
ri = 0.0f;
au = 0.0f;
rb = 0.0f;
vbeq = 0.0f;
m_vbeq = 0.0f;
beta = 0.0f;
rl = 0.0f;
rbb = 0.0f;
rbe = 0.0f;
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CExpDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CExpDlg)
DDX_Control(pDX, IDC_BUTTON2, m_cal2);
DDX_Control(pDX, IDC_BUTTON1, m_cal);
DDX_Text(pDX, IDC_EDIT12, m_cb);
DDX_Text(pDX, IDC_EDIT11, m_rc);
DDX_Text(pDX, IDC_EDIT10, m_ubqx);
DDX_Text(pDX, IDC_EDIT13, m_cc);
DDX_Text(pDX, IDC_EDIT14, m_ce);
DDX_Text(pDX, IDC_EDIT15, m_beta);
DDX_Text(pDX, IDC_EDIT16, m_ri);
DDX_Text(pDX, IDC_EDIT17, m_rbb);
DDX_Text(pDX, IDC_EDIT18, m_ucc);
DDX_Text(pDX, IDC_EDIT2, m_icq);
DDX_Text(pDX, IDC_EDIT3, m_au);
DDX_Text(pDX, IDC_EDIT4, m_ubq);
DDX_Text(pDX, IDC_EDIT5, m_re);
DDX_Text(pDX, IDC_EDIT6, m_rb2x);
DDX_Text(pDX, IDC_EDIT7, m_rb2);
DDX_Text(pDX, IDC_EDIT8, m_rb1);
DDX_Text(pDX, IDC_EDIT9, m_ibq);
DDX_Text(pDX, IDC_EDIT19, m_rl);
DDX_Text(pDX, IDC_EDIT20, m_cbx);
DDX_Text(pDX, IDC_EDIT21, m_ccx);
DDX_Text(pDX, IDC_EDIT22, m_cex);
DDX_Text(pDX, IDC_EDIT23, m_fl);
DDX_Text(pDX, IDC_EDIT24, m_rs);
DDX_Text(pDX, IDC_EDIT1, re);
DDX_Text(pDX, IDC_EDIT25, rb2);
DDX_Text(pDX, IDC_EDIT26, rb1);
DDX_Text(pDX, IDC_EDIT27, rc);
DDX_Text(pDX, IDC_EDIT29, vcc);
DDX_Text(pDX, IDC_EDIT30, vbb);
DDX_Text(pDX, IDC_EDIT31, vceq);
DDX_Text(pDX, IDC_EDIT32, ibq);
DDX_Text(pDX, IDC_EDIT33, icq);
DDX_Text(pDX, IDC_EDIT34, ri);
DDX_Text(pDX, IDC_EDIT35, au);
DDX_Text(pDX, IDC_EDIT36, rb);
DDX_Text(pDX, IDC_EDIT37, vbeq);
DDX_Text(pDX, IDC_EDIT38, m_vbeq);
DDX_Text(pDX, IDC_EDIT40, beta);
DDX_Text(pDX, IDC_EDIT41, rl);
DDX_Text(pDX, IDC_EDIT42, rbb);
DDX_Text(pDX, IDC_EDIT43, rbe);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CExpDlg, CDialog)
//{{AFX_MSG_MAP(CExpDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2)
ON_EN_CHANGE(IDC_EDIT5, OnChangeEdit5)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CExpDlg message handlers
BOOL CExpDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
m_icq=float(1.8);
m_au=float(50);
m_beta=float(150);
m_rbb=float(300);
m_ucc=float(12);
m_rl=float(2);
m_ubqx=float(4);
m_rb2x=float(8);
m_cbx=float(10);
m_ccx=float(10);
m_cex=float(3);
m_fl=float(100);
m_rs=float(50);
m_vbeq=float(0.7);
vbeq=float(0.7);
rbb=float(300);
beta=float(150);
vcc=float(12);
rl=float(2);
UpdateData(false);
return TRUE; // return TRUE unless you set the focus to a control
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CExpDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CExpDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CExpDlg::OnChangeEdit2()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
void CExpDlg::OnChangeEdit5()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
void CExpDlg::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData(true);
m_ri=(m_rbb+m_beta*float(26)/m_icq)/float(1000);
m_ubq=m_ucc/m_ubqx;
m_ibq=m_icq/m_beta;
m_rb2=m_ubq/m_ibq/m_rb2x;
m_rb1=(m_ubqx-1)*m_rb2;
m_re=(m_ubq-m_vbeq)/m_icq;
m_rc=m_rl*(m_au*m_ri/m_beta)/(m_rl-m_au*m_ri/m_beta);
m_cb=m_cbx/(float(2*3.14159)*m_fl*(m_rs/float(1000)+m_ri))*float(1000);
m_cc=m_ccx/(float(2*3.14159)*m_fl*(m_rc+m_rl))*float(1000);
m_ce=m_cex/(float(2*3.14159)*m_fl*((m_rs/float(1000)+m_ri)/(m_beta+float(1))))*float(1000);
UpdateData(false);
}
void CExpDlg::OnButton2()
{
// TODO: Add your control notification handler code here
UpdateData(true);
vbb=(rb2/(rb1+rb2))*vcc;
rb=rb1*rb2/(rb1+rb2);
ibq=(vbb-vbeq)/(rb+(beta+1)*re);
icq=beta*ibq;
vceq=vcc-(rc+re);
rbe=(rbb+(beta+1)*float(26)/icq)/float(1000);
au=beta*(rl*rc/(rl+rc))/rbe;
ri=rb*rbe/(rb+rbe);
UpdateData(false);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -