資源簡介
2013 duilib入門簡明教程系列的所有資源和代碼。
代碼片段和文件信息
#include?“resource.h“
#include?“frameWnd.h“
#include?“MenuWnd.h“
CframeWnd::CframeWnd(?LPCTSTR?pszxmlPath?)
:?CxmlWnd(pszxmlPath)
{
}
void?CframeWnd::InitWindow()
{
//????SetIcon(IDR_MAINframe);?//?設置任務欄圖標
????CenterWindow();
????//?初始化CActiveXUI控件
????CActiveXUI*?pActiveXUI?=?static_cast(m_PaintManager.FindControl(_T(“ActiveXDemo1“)));
????if(?pActiveXUI?)?
????{
????????IWebBrowser2*?pWebBrowser?=?NULL;
????????pActiveXUI->SetDelayCreate(false);??????????????//?相當于界面設計器里的DelayCreate屬性改為FALSE,在duilib自帶的FlashDemo里可以看到此屬性為TRUE?????????????
????????pActiveXUI->CreateControl(CLSID_WebBrowser);????//?相當于界面設計器里的Clsid屬性里填入{8856F961-340A-11D0-A96B-00C04FD705A2},建議用CLSID_WebBrowser,如果想看相應的值,請見
????????pActiveXUI->GetControl(IID_IWebBrowser2?(void**)&pWebBrowser);
????????if(?pWebBrowser?!=?NULL?)?
????????{
????????????//pWebBrowser->Navigate(L“https://code.google.com/p/duilib/“NULLNULLNULLNULL);??
????????????pWebBrowser->Navigate(L“http://www.baidu.com/“NULLNULLNULLNULL);??//?由于谷歌時不時被墻,所以換成反應快的網站
????????????pWebBrowser->Release();
????????}
????}
????//?初始化CProgressUI控件
????CProgressUI*?pProgress?=?static_cast(m_PaintManager.FindControl(_T(“ProgressDemo1“)));????
????pProgress->SetValue(100);
????//?初始化CListUI控件
????CDuiString?str;
????CListUI*?pList?=?static_cast(m_PaintManager.FindControl(_T(“ListDemo1“)));
????for?(int?i?=?0;?i?100;?i++)
????{
????????CListTextElementUI*?pListElement?=?new?CListTextElementUI;
????????pListElement->SetTag(i);
????????pList->Add(pListElement);
????????str.Format(_T(“%d“)?i);
????????pListElement->SetText(0?str);
????????pListElement->SetText(1?_T(“haha“));
????}
}
void?CframeWnd::Notify(?TNotifyUI&?msg?)
{
????if(?msg.sType?==?_T(“click“)?)?
????{
????????if(?msg.pSender->GetName()?==?_T(“btnMenu“)?)?
????????{
????????????POINT?pt?=?{msg.ptMouse.x?msg.ptMouse.y};
????????????CMenuWnd?*pMenu?=?new?CMenuWnd(_T(“Menu/menu.xml“));
????????????pMenu->Init(*this?pt);
????????????pMenu->ShowWindow(TRUE);
????????}
????}
????else?if(msg.sType?==?_T(“selectchanged“))
????{
????????CDuiString????strName?????=?msg.pSender->GetName();
????????CTabLayoutUI*?pControl?=?static_cast(m_PaintManager.FindControl(_T(“tabTest“)));
????????if(strName?==?_T(“OptionDemo1“))
????????????pControl->SelectItem(0);
????????else?if(strName?==?_T(“OptionDemo2“))
????????????pControl->SelectItem(1);
????????else?if(strName?==?_T(“OptionDemo3“))
????????????pControl->SelectItem(2);
????}
????__super::Notify(msg);
}
CControlUI*?CframeWnd::CreateControl(?LPCTSTR?pstrClassName?)
{
????if?(_tcsicmp(pstrClassName?_T(“Wnd“))?==?0)
????{
????????CWndUI??*pUI??=?new?CWndUI;????????????
????????HWND????hWnd??=?CreateWindow(_T(“BUTTON“)?_T(“win32“)?WS_VISIBLE?|?WS_CHILD?|?BS_PUSHBUTTON?0?0?0?0?m_PaintManager.GetPaintWindow()?NULL?NULL?NULL);
????????pUI->Attach(hWnd);
- 上一篇:旅游管理系統(代碼+文檔)
- 下一篇:stm32_RSA.zip
評論
共有 條評論