📄 myxls.cpp
字号:
// MyXLS.cpp : implementation file
//
#include "stdafx.h"
#include "computer.h"
#include "MyXLS.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyXLS dialog
#include "ComputerDlg.h"
extern CComputerDlg * computerdlg;
CMyXLS::CMyXLS(CWnd* pParent /*=NULL*/)
: CDialog(CMyXLS::IDD, pParent)
{
//{{AFX_DATA_INIT(CMyXLS)
m_sh = 0.0;
m_length = 0.0;
m_cxspm = _T("");
//}}AFX_DATA_INIT
}
void CMyXLS::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyXLS)
DDX_Control(pDX, IDC_COMBO1, m_choosexspm);
DDX_Control(pDX, IDC_EDIT4, m_edit2);
DDX_Control(pDX, IDC_BUTTON1, m_button);
DDX_Text(pDX, IDC_EDIT2, m_sh);
DDX_Text(pDX, IDC_EDIT4, m_length);
DDX_CBString(pDX, IDC_COMBO1, m_cxspm);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyXLS, CDialog)
//{{AFX_MSG_MAP(CMyXLS)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_WM_DESTROY()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyXLS message handlers
void CMyXLS::OnButton1()
{
// TODO: Add your control notification handler code here
UpdateData(true);
// m_sh=m_xspm*m_length;
double xspm=0;
int i=m_choosexspm.GetCurSel();
if(i!=-1)
{
CString show="";
m_choosexspm.GetLBText(i,show);
if(show=="SYWV-50-23(7/8\")")
xspm=3.92;
else if(show=="SYWV-50-22(1/2\")")
xspm=7.22;
else if(show=="SYWV-50-10")
xspm=11.3;
else if(show=="SYV-50-7-1")
xspm=25;
}
else
xspm=atof(m_cxspm);
m_sh=xspm*m_length;
CString str;
str.Format("%0.5f",m_sh);
m_sh=atof(str);
UpdateData(false);
}
void CMyXLS::OnDestroy()
{
CDialog::OnDestroy();
// TODO: Add your message handler code here
computerdlg->MyXLS=NULL;
computerdlg->Invalidate(false);
delete this;
}
BOOL CMyXLS::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);
return CDialog::PreTranslateMessage(pMsg);
}
BOOL CMyXLS::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
pSub[0] = GetDlgItem(IDC_COMBO1);
pSub[1] = GetDlgItem(IDC_EDIT4);
pSub[2]=GetDlgItem(IDC_EDIT2);
/*
GetDlgItem(IDC_COMBO1)->GetClientRect(rect);//刚才多写了,需要
*/
m_tip[0].Create(pSub[0],TTS_ALWAYSTIP);
m_tip[0].AddTool(pSub[0]);
/*
m_tip[0].Activate(true);
//m_tip[0].SetTipBkColor(RGB(0,144,18));
//m_tip[0].SetTipTextColor(RGB(255,254,255));
m_tip[0].SetDelayTime(50);
m_tip[0].SetDelayTime(TTDT_AUTOPOP,8000);
m_tip[0].SetMaxTipWidth(290);
*/
/* 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_choosexspm.AddString("SYWV-50-23(7/8\")");
m_choosexspm.AddString("SYWV-50-10");
m_choosexspm.AddString("SYWV-50-22(1/2\")");
m_choosexspm.AddString("SYV-50-7-1");
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CMyXLS::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[0].Create(this);
m_tip[0].Activate(true);
//m_tip[0].SetTipBkColor(RGB(0,144,18));
//m_tip[0].SetTipTextColor(RGB(255,254,255));
m_tip[0].SetDelayTime(50);
m_tip[0].SetDelayTime(TTDT_AUTOPOP,8000);
m_tip[0].SetMaxTipWidth(290);
m_tip[0].Activate(true);
m_tip[0].Update();
m_tip[0].AddTool(GetDlgItem(IDC_COMBO1),"可以直接输入线损值或是选择电缆型号,系统将按该电缆型号的衰耗值进行计算",&rect);
*/
m_tip[0].AddTool(GetDlgItem(IDC_COMBO1),"可以直接输入线损值或是选择电缆型号,系统将按该电缆型号的衰耗值进行计算");
m_tip[0].Activate(true);
m_tip[0].Update();
CDialog::OnMouseMove(nFlags, point);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -