📄 mylength.cpp
字号:
// MyLength.cpp : implementation file
//
#include "stdafx.h"
#include "computer.h"
#include "MyLength.h"
#include "math.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyLength dialog
#include "ComputerDlg.h"
extern CComputerDlg * computerdlg;
CMyLength::CMyLength(CWnd* pParent /*=NULL*/)
: CDialog(CMyLength::IDD, pParent)
{
//{{AFX_DATA_INIT(CMyLength)
m_P = 0.0;
m_sh1 = 0.0;
m_sh2 = 0.0;
m_cq = 0.0;
m_length = 0.0;
//}}AFX_DATA_INIT
}
void CMyLength::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyLength)
DDX_Control(pDX, IDC_EDIT4, m_edit4);
DDX_Control(pDX, IDC_EDIT9, m_edit3);
DDX_Control(pDX, IDC_EDIT7, m_edit2);
DDX_Control(pDX, IDC_EDIT1, m_edit1);
DDX_Control(pDX, IDC_BUTTON1, m_button1);
DDX_Text(pDX, IDC_EDIT1, m_P);
DDX_Text(pDX, IDC_EDIT7, m_sh1);
DDX_Text(pDX, IDC_EDIT9, m_sh2);
DDX_Text(pDX, IDC_EDIT4, m_cq);
DDX_Text(pDX, IDC_EDIT8, m_length);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyLength, CDialog)
//{{AFX_MSG_MAP(CMyLength)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_WM_DESTROY()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyLength message handlers
void CMyLength::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData(true);
double y=0;
y=(m_P-m_cq-32.44-20*log10(computerdlg->m_F)-m_sh1-m_sh2)/20;
m_length=pow(10,y)-20;
m_length=m_length*1000;
CString str;
str.Format("%0.5f",m_length);
m_length=atof(str);
UpdateData(false);
}
void CMyLength::OnDestroy()
{
CDialog::OnDestroy();
// TODO: Add your message handler code here
computerdlg->MyLength=NULL;
computerdlg->Invalidate(false);
delete this;
}
BOOL CMyLength::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
pSub[0] = GetDlgItem(IDC_EDIT1);
pSub[1] = GetDlgItem(IDC_EDIT7);
pSub[2]=GetDlgItem(IDC_EDIT9);
pSub[3] = GetDlgItem(IDC_EDIT4);
pSub[4] = GetDlgItem(IDC_EDIT8);
m_tip[0].Create(pSub[0],TTS_ALWAYSTIP);
m_tip[0].AddTool(pSub[0]);
m_tip[1].Create(pSub[1],TTS_ALWAYSTIP);
m_tip[1].AddTool(pSub[1]);
m_tip[2].Create(pSub[2],TTS_ALWAYSTIP);
m_tip[2].AddTool(pSub[2]);
m_tip[3].Create(pSub[3],TTS_ALWAYSTIP);
m_tip[3].AddTool(pSub[3]);
m_tip[4].Create(pSub[4],TTS_ALWAYSTIP);
m_tip[4].AddTool(pSub[4]);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CMyLength::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(m_tip[0].m_hWnd!=NULL)
m_tip[0].RelayEvent(pMsg);
if(m_tip[1].m_hWnd!=NULL)
m_tip[1].RelayEvent(pMsg);
if(m_tip[2].m_hWnd!=NULL)
m_tip[2].RelayEvent(pMsg);
if(m_tip[3].m_hWnd!=NULL)
m_tip[3].RelayEvent(pMsg);
if(m_tip[4].m_hWnd!=NULL)
m_tip[4].RelayEvent(pMsg);
return CDialog::PreTranslateMessage(pMsg);
}
void CMyLength::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_tip[0].UpdateTipText("发射功率大小!",pSub[0]);
m_tip[1].UpdateTipText("衰耗一:从发射点至覆盖区域边缘之间的阻挡衰耗",pSub[1]);
m_tip[2].UpdateTipText("衰耗二:为建筑物外表的阻挡衰耗",pSub[2]);
m_tip[3].UpdateTipText("泄漏场强值",pSub[3]);
m_tip[4].UpdateTipText("距离",pSub[4]);
CDialog::OnMouseMove(nFlags, point);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -