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

📄 mybjc.cpp

📁 关于移动通信工程常用的计算工具
💻 CPP
字号:
// MybjC.cpp : implementation file
//

#include "stdafx.h"
#include "computer.h"
#include "MybjC.h"
#include "math.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMybjC dialog
#include "ComputerDlg.h"
extern CComputerDlg * computerdlg;

CMybjC::CMybjC(CWnd* pParent /*=NULL*/)
	: CDialog(CMybjC::IDD, pParent)
{
	//{{AFX_DATA_INIT(CMybjC)
	m_p = 0.0;
	m_sh = 0.0;
	m_length = 0.0;
	m_C = 0.0;
	m_sh2 = 0.0;
	m_xlc = 0.0;
	//}}AFX_DATA_INIT
}


void CMybjC::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMybjC)
	DDX_Control(pDX, IDC_EDIT5, m_edit4);
	DDX_Control(pDX, IDC_EDIT3, m_edit3);
	DDX_Control(pDX, IDC_EDIT2, m_edit2);
	DDX_Control(pDX, IDC_EDIT1, m_edit1);
	DDX_Control(pDX, IDOK, m_button2);
	DDX_Control(pDX, IDC_BUTTON1, m_button1);
	DDX_Text(pDX, IDC_EDIT1, m_p);
	DDX_Text(pDX, IDC_EDIT2, m_sh);
	DDX_Text(pDX, IDC_EDIT3, m_length);
	DDX_Text(pDX, IDC_EDIT4, m_C);
	DDX_Text(pDX, IDC_EDIT5, m_sh2);
	DDX_Text(pDX, IDC_EDIT6, m_xlc);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CMybjC, CDialog)
	//{{AFX_MSG_MAP(CMybjC)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_WM_DESTROY()
	ON_WM_MOUSEMOVE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMybjC message handlers

void CMybjC::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(true);

	if(m_length>0)
	m_C=m_p-32.44-20*log10(m_length/1000)-20*log10(computerdlg->m_F)-m_sh;
	else MessageBox("距离必须大于零","华泰提示:");

CString str;
str.Format("%0.5f",m_C);
m_C=atof(str);
	UpdateData(false);


//	CDialog::OnOK();
}

void CMybjC::OnButton1() 
{
	// TODO: Add your control notification handler code here
	UpdateData(true);
if(m_length>0)
	m_xlc=m_p-32.44-20*log10((m_length/1000)+20)-20*log10(computerdlg->m_F)-m_sh-m_sh2;
	else MessageBox("距离必须大于零","华泰提示:");
CString str;
str.Format("%0.5f",m_xlc);
m_xlc=atof(str);
	UpdateData(false);
}

void CMybjC::OnDestroy() 
{
	CDialog::OnDestroy();
	
	// TODO: Add your message handler code here
computerdlg->MybjC=NULL;
computerdlg->Invalidate(false);
	delete this;
}

BOOL CMybjC::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	pSub[0] = GetDlgItem(IDC_EDIT1);
	pSub[1] = GetDlgItem(IDC_EDIT2);
	pSub[2]=GetDlgItem(IDC_EDIT3);
	pSub[3] = GetDlgItem(IDC_EDIT4);
	pSub[4] = GetDlgItem(IDC_EDIT5);
	pSub[5]=GetDlgItem(IDC_EDIT6);

	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]);
    m_tip[5].Create(pSub[5],TTS_ALWAYSTIP);
	m_tip[5].AddTool(pSub[5]);

//	m_tip[0].SetTipTextColor(RGB(0,0,255));
//    m_tip[0].SetDelayTime(150);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

BOOL CMybjC::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);
		if(m_tip[5].m_hWnd!=NULL)
       m_tip[5].RelayEvent(pMsg);
	return CDialog::PreTranslateMessage(pMsg);
}

void CMybjC::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]);
	m_tip[5].UpdateTipText("泄漏场强值",pSub[5]);
	CDialog::OnMouseMove(nFlags, point);
}

⌨️ 快捷键说明

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