关于测试工程提示信息功能的说明
来源:互联网 发布:潭州seo研究中心 编辑:程序博客网 时间:2024/05/16 16:14
关于测试工程提示信息功能的说明
该功能的实现完全依赖于CPPToolTip类,该类可以在 http://www.codeproject.com/ 上下载到。具体说明见该网站的介绍。
本程序所需要的功能是点击工具栏的“属性”按钮之后,屏幕右下角弹出测试工程的详细属性。在屏幕任何地方单击鼠标左键之后,信息提示框消失。
因此,本程序没有直接按照codeproject上的介绍那样使用CPPToolTip类,而是当点击“属性”按钮之后,调用ShowHelpTooltip函数。
在ShowHelpTooltip函数的重载版本void ShowHelpTooltip (LPPOINT pt, LPCTSTR lpszString, HICON hIcon = NULL)中,lpszString支持HTML文本,因此可以利用HTML控制显示信息的格式。
弹出的信息提示框如下图所示。
源代码如下:
/**///// MainFrm.h中定义
public:
CPPToolTip m_toolTip; // 显示测试属性的提示框
/**///// MainFrm.cpp中
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
...{
……
m_toolTip.Create(this);
//Adds tooltip for toolbar
m_toolTip.AddToolBar(&m_ProperBar);
……
}
// 显示测试工程的属性
void CEMCView::OnEditProper()
...{
// TODO: 在此添加命令处理程序代码
if(m_bIsWorking && !m_bOldVersion)
...{
CEMCDoc* pDoc=GetDocument();
CMainFrame* pmfrm=(CMainFrame*)AfxGetMainWnd();
pmfrm->m_toolTip.SetDirection(PPTOOLTIP_BOTTOMEDGE_CENTER);
pmfrm->m_toolTip.AddTool(this,L"测试文件属性");
// pmfrm->m_toolTip.SetColorBk(RGB(0,0,255),RGB(192,192,192));
CPoint pt;
CRect rc;
GetClientRect(&rc);
ClientToScreen(&rc);
pt.x=rc.right;
pt.y=rc.bottom; // pt为客户区窗口右下角对应的点
// 利用HTML控制提示框的显示格式
// 显示测试工程属性
CString info=L"";
CString str=L"<center><h2><font face="黑体" color=red>测试工程属性</font></h2><br><hr color=blue></center><br>";
info+=str;
str.Format(L"<font size=14>测试类型:</font>");
info+=str;
if(pDoc->m_pTestPrj->m_TestCon==CE102)
...{
str.Format(L"<span class=cpp-comment>CE102测试</span>");
}
else if(pDoc->m_pTestPrj->m_TestCon==RE102)
...{
str.Format(L"<span class=cpp-comment>RE102测试</span>");
}
info+=str;
str.Format(L" <font size=14>测试设备:</font>");
info+=str;
switch(pDoc->m_pTestPrj->m_TestEquip)
...{
case TEST_EQUIP_NONE:
str.Format(L"<span class=cpp-comment>无</span><br>");
break;
case CUR_PROBE:
str.Format(L"<span class=cpp-comment>电流探头</span><br>");
break;
case ET_G:
str.Format(L"<span class=cpp-comment>ET-G</span><br>");
break;
case ET_Q:
str.Format(L"<span class=cpp-comment>ET-Q</span><br>");
break;
case HT_1:
str.Format(L"<span class=cpp-comment>HT-1</span><br>");
break;
case HT_6:
str.Format(L"<span class=cpp-comment>HT-6</span><br>");
break;
case LISN:
str.Format(L"<span class=cpp-comment>LISN</span><br>");
break;
case EZ_17:
str.Format(L"<span class=cpp-comment>EZ-17</span><br>");
break;
}
info+=str;
str.Format(L"<font size=14>起始频率:</font>");
info+=str;
str.Format(L"<span class=cpp-comment>%5.2fMHz</span>",pDoc->m_pTestPrj->m_StartFreq);
info+=str;
str.Format(L" <font size=14>终止频率:</font>");
info+=str;
str.Format(L"<span class=cpp-comment>%5.2fMHz</span><br>",pDoc->m_pTestPrj->m_StopFreq);
info+=str;
str.Format(L"<font size=14>EUT电压:</font>");
info+=str;
if(pDoc->m_pTestPrj->m_TestCon==RE102)
str.Format(L"<span class=cpp-comment>N/A</span> ");
else
str.Format(L"<span class=cpp-comment>%5.2fV</span>",pDoc->m_pTestPrj->m_EUTVolt);
info+=str;
str.Format(L" <font size=14>待测设备:</font>");
info+=str;
if(pDoc->m_pTestPrj->m_EUTName!=L"")
str.Format(L"<span class=cpp-comment>%s</span><br>",pDoc->m_pTestPrj->m_EUTName);
else
str.Format(L"<span class=cpp-comment>N/A</span><br>");
info+=str;
str.Format(L"<font size=14>测试模式:</font>");
info+=str;
if(pDoc->m_pTestPrj->m_TestCon==RE102)
str.Format(L" <span class=cpp-comment>N/A</span> ");
else
...{
switch(pDoc->m_pTestPrj->m_TestMode)
...{
case TEST_MODE_NONE:
str.Format(L"<span class=cpp-comment>无</span> ");
break;
case DIFFER:
str.Format(L"<span class=cpp-comment>差模</span>");
break;
case COMMON:
str.Format(L"<span class=cpp-comment>共模</span>");
break;
}
}
info+=str;
str.Format(L" <font size=14>测试距离:</font>");
info+=str;
if(pDoc->m_pTestPrj->m_TestCon==CE102)
str.Format(L"<span class=cpp-comment>N/A</span><br>");
else
str.Format(L"<span class=cpp-comment>%5.2fm</span><br>",pDoc->m_pTestPrj->m_TestDist);
info+=str;
// 显示频谱仪设置
str.Format(L"<br><center><h2><font face="黑体" color=red>频谱仪设置</font></h2><br><hr color=blue></center><br>");
info+=str;
str.Format(L"<font size=14>RBW :</font>");
info+=str;
if(pDoc->m_pTestPrj->m_TestBand==9)
str.Format(L"<span class=cpp-comment>9KHz</span> ");
else if(pDoc->m_pTestPrj->m_TestBand==120)
str.Format(L"<span class=cpp-comment>120KHz</span>");
else
str.Format(L"<span class=cpp-comment>AUTO</span> ");
info+=str;
str.Format(L" <font size=14>显示模式:</font>");
info+=str;
switch(pDoc->m_pTestPrj->m_DispPattern)
...{
case SAMPLE:
str.Format(L"<span class=cpp-comment>SAMPLE</span><br>");
break;
case MIN_HOLD:
str.Format(L"<span class=cpp-comment>MIN.HOLD</span><br>");
break;
case MAX_HOLD:
str.Format(L"<span class=cpp-comment>MAX.HOLD</span><br>");
break;
}
info+=str;
str.Format(L"<font size=14>内部衰减:</font>");
info+=str;
str.Format(L"<span class=cpp-comment>%ddB</span> ",pDoc->m_pTestPrj->m_InnerAttenuator);
info+=str;
str.Format(L" <font size=14>外部衰减:</font>");
info+=str;
str.Format(L"<span class=cpp-comment>%ddB</span><br>",pDoc->m_pTestPrj->m_OuterAttenuator);
info+=str;
pmfrm->m_toolTip.ShowHelpTooltip(&pt,info);
}
}
public:
CPPToolTip m_toolTip; // 显示测试属性的提示框
/**///// MainFrm.cpp中
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
...{
……
m_toolTip.Create(this);
//Adds tooltip for toolbar
m_toolTip.AddToolBar(&m_ProperBar);
……
}
// 显示测试工程的属性
void CEMCView::OnEditProper()
...{
// TODO: 在此添加命令处理程序代码
if(m_bIsWorking && !m_bOldVersion)
...{
CEMCDoc* pDoc=GetDocument();
CMainFrame* pmfrm=(CMainFrame*)AfxGetMainWnd();
pmfrm->m_toolTip.SetDirection(PPTOOLTIP_BOTTOMEDGE_CENTER);
pmfrm->m_toolTip.AddTool(this,L"测试文件属性");
// pmfrm->m_toolTip.SetColorBk(RGB(0,0,255),RGB(192,192,192));
CPoint pt;
CRect rc;
GetClientRect(&rc);
ClientToScreen(&rc);
pt.x=rc.right;
pt.y=rc.bottom; // pt为客户区窗口右下角对应的点
// 利用HTML控制提示框的显示格式
// 显示测试工程属性
CString info=L"";
CString str=L"<center><h2><font face="黑体" color=red>测试工程属性</font></h2><br><hr color=blue></center><br>";
info+=str;
str.Format(L"<font size=14>测试类型:</font>");
info+=str;
if(pDoc->m_pTestPrj->m_TestCon==CE102)
...{
str.Format(L"<span class=cpp-comment>CE102测试</span>");
}
else if(pDoc->m_pTestPrj->m_TestCon==RE102)
...{
str.Format(L"<span class=cpp-comment>RE102测试</span>");
}
info+=str;
str.Format(L" <font size=14>测试设备:</font>");
info+=str;
switch(pDoc->m_pTestPrj->m_TestEquip)
...{
case TEST_EQUIP_NONE:
str.Format(L"<span class=cpp-comment>无</span><br>");
break;
case CUR_PROBE:
str.Format(L"<span class=cpp-comment>电流探头</span><br>");
break;
case ET_G:
str.Format(L"<span class=cpp-comment>ET-G</span><br>");
break;
case ET_Q:
str.Format(L"<span class=cpp-comment>ET-Q</span><br>");
break;
case HT_1:
str.Format(L"<span class=cpp-comment>HT-1</span><br>");
break;
case HT_6:
str.Format(L"<span class=cpp-comment>HT-6</span><br>");
break;
case LISN:
str.Format(L"<span class=cpp-comment>LISN</span><br>");
break;
case EZ_17:
str.Format(L"<span class=cpp-comment>EZ-17</span><br>");
break;
}
info+=str;
str.Format(L"<font size=14>起始频率:</font>");
info+=str;
str.Format(L"<span class=cpp-comment>%5.2fMHz</span>",pDoc->m_pTestPrj->m_StartFreq);
info+=str;
str.Format(L" <font size=14>终止频率:</font>");
info+=str;
str.Format(L"<span class=cpp-comment>%5.2fMHz</span><br>",pDoc->m_pTestPrj->m_StopFreq);
info+=str;
str.Format(L"<font size=14>EUT电压:</font>");
info+=str;
if(pDoc->m_pTestPrj->m_TestCon==RE102)
str.Format(L"<span class=cpp-comment>N/A</span> ");
else
str.Format(L"<span class=cpp-comment>%5.2fV</span>",pDoc->m_pTestPrj->m_EUTVolt);
info+=str;
str.Format(L" <font size=14>待测设备:</font>");
info+=str;
if(pDoc->m_pTestPrj->m_EUTName!=L"")
str.Format(L"<span class=cpp-comment>%s</span><br>",pDoc->m_pTestPrj->m_EUTName);
else
str.Format(L"<span class=cpp-comment>N/A</span><br>");
info+=str;
str.Format(L"<font size=14>测试模式:</font>");
info+=str;
if(pDoc->m_pTestPrj->m_TestCon==RE102)
str.Format(L" <span class=cpp-comment>N/A</span> ");
else
...{
switch(pDoc->m_pTestPrj->m_TestMode)
...{
case TEST_MODE_NONE:
str.Format(L"<span class=cpp-comment>无</span> ");
break;
case DIFFER:
str.Format(L"<span class=cpp-comment>差模</span>");
break;
case COMMON:
str.Format(L"<span class=cpp-comment>共模</span>");
break;
}
}
info+=str;
str.Format(L" <font size=14>测试距离:</font>");
info+=str;
if(pDoc->m_pTestPrj->m_TestCon==CE102)
str.Format(L"<span class=cpp-comment>N/A</span><br>");
else
str.Format(L"<span class=cpp-comment>%5.2fm</span><br>",pDoc->m_pTestPrj->m_TestDist);
info+=str;
// 显示频谱仪设置
str.Format(L"<br><center><h2><font face="黑体" color=red>频谱仪设置</font></h2><br><hr color=blue></center><br>");
info+=str;
str.Format(L"<font size=14>RBW :</font>");
info+=str;
if(pDoc->m_pTestPrj->m_TestBand==9)
str.Format(L"<span class=cpp-comment>9KHz</span> ");
else if(pDoc->m_pTestPrj->m_TestBand==120)
str.Format(L"<span class=cpp-comment>120KHz</span>");
else
str.Format(L"<span class=cpp-comment>AUTO</span> ");
info+=str;
str.Format(L" <font size=14>显示模式:</font>");
info+=str;
switch(pDoc->m_pTestPrj->m_DispPattern)
...{
case SAMPLE:
str.Format(L"<span class=cpp-comment>SAMPLE</span><br>");
break;
case MIN_HOLD:
str.Format(L"<span class=cpp-comment>MIN.HOLD</span><br>");
break;
case MAX_HOLD:
str.Format(L"<span class=cpp-comment>MAX.HOLD</span><br>");
break;
}
info+=str;
str.Format(L"<font size=14>内部衰减:</font>");
info+=str;
str.Format(L"<span class=cpp-comment>%ddB</span> ",pDoc->m_pTestPrj->m_InnerAttenuator);
info+=str;
str.Format(L" <font size=14>外部衰减:</font>");
info+=str;
str.Format(L"<span class=cpp-comment>%ddB</span><br>",pDoc->m_pTestPrj->m_OuterAttenuator);
info+=str;
pmfrm->m_toolTip.ShowHelpTooltip(&pt,info);
}
}
- 关于测试工程提示信息功能的说明
- 关于EditTest的 信息提示
- CVS update文件的提示信息说明
- 关于文本框的提示功能
- 关于爱心工程的情况说明
- 关于VC2005工程配置的说明
- 关于Qt的.pro工程文件说明
- 关于ACM错误提示的说明
- 关于偶的专业-信息工程
- 关于信息工程一些新的理解
- 关于删除信息时的提示
- 关于信息提示框的问题
- 编程中关于本月信息的说明
- WEB功能测试说明
- 工程目录文件功能说明
- WCE 中 关于 按钮的提示功能
- 关于搜索提示功能的实现
- 关于pycharm的代码自动提示功能
- 关于POI的使用方法
- persevere in
- .Net环境下的缓存技术介绍
- 图像文件格式之PNG
- Spring整合Struts
- 关于测试工程提示信息功能的说明
- Spring整合Hibernate
- 我们自杀吧!(贴图)_2:跳楼
- 剪贴板上文本的读取与写入
- 我们自杀吧!(贴图)_3:割腕
- Nlite精简后期处理总结
- 授课班级学生作业
- 中国软件
- 应用程序使用日志有三个目的