MFC状态栏的编程(以显示系统当前时间为例)
2011-05-15 21:41
405 查看
首先:在Resourse 选项卡上面的String Table 中添加:窗格如:IDS_TIMER 时钟
其次:在MainFrame APP 文件中加入标识
如:
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
// ID_INDICATOR_CAPS,
// ID_INDICATOR_NUM,
// ID_INDICATOR_SCRL,
IDS_TIMER,
};
再次:MainFrame::OnCreate()函数中添加如下代码:
CTime t=CTime::GetCurrentTime();
CString str=t.Format("%H : %M : %S ");
CClientDC dc(this);
CSize sz=dc.GetTextExtent(str);
int index=0;
index=m_wndStatusBar.CommandToIndex(IDS_TIMER);
m_wndStatusBar.SetPaneInfo(index,IDS_TIMER,SBPS_NORMAL,sz.cx);
m_wndStatusBar.SetPaneText(index,str);
最后在OnTimer()函数中添加如下代码:
状态栏的编程
CTime t=CTime::GetCurrentTime();
CString str=t.Format("%H : %M : %S ");
CClientDC dc(this);
CSize sz=dc.GetTextExtent(str);
m_wndStatusBar.SetPaneInfo(1, IDS_TIMER, SBPS_NORMAL, sz.cx);
m_wndStatusBar.SetPaneText(1, str);
其次:在MainFrame APP 文件中加入标识
如:
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
// ID_INDICATOR_CAPS,
// ID_INDICATOR_NUM,
// ID_INDICATOR_SCRL,
IDS_TIMER,
};
再次:MainFrame::OnCreate()函数中添加如下代码:
CTime t=CTime::GetCurrentTime();
CString str=t.Format("%H : %M : %S ");
CClientDC dc(this);
CSize sz=dc.GetTextExtent(str);
int index=0;
index=m_wndStatusBar.CommandToIndex(IDS_TIMER);
m_wndStatusBar.SetPaneInfo(index,IDS_TIMER,SBPS_NORMAL,sz.cx);
m_wndStatusBar.SetPaneText(index,str);
最后在OnTimer()函数中添加如下代码:
状态栏的编程
CTime t=CTime::GetCurrentTime();
CString str=t.Format("%H : %M : %S ");
CClientDC dc(this);
CSize sz=dc.GetTextExtent(str);
m_wndStatusBar.SetPaneInfo(1, IDS_TIMER, SBPS_NORMAL, sz.cx);
m_wndStatusBar.SetPaneText(1, str);
相关文章推荐
- MFC状态栏编程(显示系统时间和进度条)
- MFC 对话框中显示系统当前时间
- VS2010用MFC显示系统当前时间
- 在状态栏中显示当前系统时间
- MFC 对话框中显示系统当前时间
- MFC在状态栏实时显示系统时间
- MFC 实现 状态栏动态显示系统时间
- VS2010用MFC显示系统当前时间
- mfc 单文档显示当前系统时间
- js动态显示系统当前时间
- 在网页中动态显示当前的系统日期和时间(最简代码)
- 获取系统当前时间星期弹框显示
- MFC状态栏显示时间
- 工作记录:系统顶端显示的当前时间
- 在该窗体上,放置一个按钮、一个标签。单击按钮时,在标签上显示当前系统时间。
- web页面上显示当前系统时间
- js----显示当前系统时间
- javascript 显示当前系统时间代码
- 是用TextView显示当前系统时间(Handler方法)
- MFC获取系统当前时间