Windows Media Player界面的实现 --SYGUI界面库应用介绍
2008-08-09 19:25:47 来源:WEB开发网3.命令 程序中实现的命令,一般与定制界面窗口中的按钮相对应
4.菜单资源 可被用于菜单条或按钮下拉菜单
5.文本对象 可被用于在界面上显示文本
6.状态对象 可被作为界面设计时可选的控制变量
下面结合例子的实际代码来介绍在程序中怎样输出各种界面对象:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
//MFC生成的其它代码
......
......
//创建各种界面对象
m_seek.SetID(ID_SLIDER_SEEK);
......
......
m_wndPlayList.Create(WS_CHILD|WS_VISIBLE|LBS_NOINTEGRALHEIGHT,CRect(0,0,0,0),this,0);
m_wndPlayList.SetFont(g_pFontMgr->GetFont(FONT_MENU));
m_wndPlayList.SetBkColor(RGB(0,0,0));
m_wndPlayList.AddString("测试.wam");
//输出窗口对象
g_pNRWMgr->ExportWnd(1,&m_wndPlayList,_T("WND_PLAYLIST"));
g_pNRWMgr->ExportWnd(2,&m_cbPlayList,_T("COMBOBOX_PLAYLIST"));
//输出SYITEM对象
g_pNRWMgr->ExportItem(0,&m_seek,_T("SLIDER_SEEK"));
......
......
g_pNRWMgr->ExportItem(23,&m_playIcon,_T("PLAY_ICON"));
//输出命令
g_pNRWMgr->ExportCommand(ID_PLAY,_T("ID_PLAY"));
......
......
g_pNRWMgr->ExportCommand(ID_THEME,_T("ID_THEME"));
//输出文本
g_pNRWMgr->ExportText(PLAY_TIME_TEXT,_T("PLAY_TIME_TEXT"));
g_pNRWMgr->ExportText(PLAY_INFO_TEXT,_T("PLAY_INFO_TEXT"));
g_pNRWMgr->ExportText(MEDIA_INFO_TEXT,_T("MEDIA_INFO_TEXT"));
g_pNRWMgr->ExportText(SPEAKER_NAME,_T("SPEAKER_NAME"));
g_pNRWMgr->ExportText(EQPRESET_NAME,_T("EQPRESET_NAME"));
//输出菜单资源
g_pNRWMgr->ExportMenu(IDR_MAINFRAME,_T("IDR_MAINFRMAE"));
//输出状态
g_pNRWMgr->ExportState(PLAY_STATE,_T("PLAY_STATE"),0,255);
//创建不规则窗体模版,在模板文件创建后应删除或注释掉下面的语句
//g_pNRWMgr->CreateTemplate(_T("d:test.tpl"));
//设置文本和状态初始值
g_pNRWMgr->SetText(EQPRESET_NAME,_eq_preset_name[m_nEQPreset]);
g_pNRWMgr->SetText(SPEAKER_NAME,_speaker_name[m_nSpeaker]);
g_pNRWMgr->SetText(MEDIA_INFO_TEXT,_T("歌曲:测试 艺术家:未知 唱片集:测试 "));
if (m_wndPlayList.GetCount() > 0)
g_pNRWMgr->SetText(PLAY_INFO_TEXT,_T("准备就绪"));
else
g_pNRWMgr->SetText(PLAY_INFO_TEXT,_T(""));
g_pNRWMgr->SetState(PLAY_STATE,0);
//恢复程序布局
CString strLayout = g_strPath + _T("LayoutWMPlayer.lyt");
g_pThemeMgr->LoadLayout(strLayout);
//加载外观风格文件
CString strTheme;
g_pThemeMgr->GetLastThemeFile(strTheme);
if (!strTheme.IsEmpty())
g_pThemeMgr->LoadTheme(strTheme);
return 0;
}
上面代码中
更多精彩
赞助商链接