CImageList CObjectUIHandler::GetImageList() { CImageList imageList; imageList.Create( 64, 32, // 16, 16, ILC_COLOR8|ILC_MASK, sizeof(anIconIDs)/sizeof(anIconIDs[0]), 1); for ( int i=0; i < sizeof(anIconIDs)/sizeof(anIconIDs[0]); i++ ) { HICON hIcon = ::LoadIcon( _Module.GetResourceInstance(), MAKEINTRESOURCE(anIconIDs[i]) ); /* Uncomment this if you want 32x32 icon. HICON hIcon = (HICON)::LoadImage( _Module.GetResourceInstance(), MAKEINTRESOURCE(anIconIDs[i]), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR ); */ imageList.AddIcon( hIcon ); } return imageList; }
bool CToolWindow::TryToIntegrate(HWND hWnd) { if (m_hWnd) return true; // this is singleton, integrate only first time CFindWnd finder(hWnd, TOOLBARCLASSNAME); // TODO: do it safer if (!finder.m_hWnd) return false; SubclassWindow(finder.m_hWnd); if (!::IsWindow(this->m_hWnd)) return true; // HACK CImageList il = GetImageList(); m_IconBase = il.GetImageCount(); il.AddIcon(LoadIcon(GetBaseModule().GetModuleInstance(), MAKEINTRESOURCE(IDI_XREFRESHA))); il.AddIcon(LoadIcon(GetBaseModule().GetModuleInstance(), MAKEINTRESOURCE(IDI_XREFRESHZ))); return true; }
BOOL CNBTreeListView::Initialize() { // Initialize Column HDITEM col = { 0 }; col.mask = HDI_FORMAT | HDI_TEXT | HDI_WIDTH; col.fmt = HDF_LEFT; // SetExtendedListViewStyle ( LVS_EX_FULLROWSELECT); int i = 0; CString strHeader; for ( i=0; i < RTL_NUMBER_OF(column_info); i++ ) { strHeader.LoadString( column_info[i].nColHeaderID ); col.cxy = column_info[i].nWidth; col.pszText = strHeader.LockBuffer(); GetHeaderControl().InsertItem(i, &col); CHeaderCtrl wndHeader = GetHeaderControl(); } // Image List CImageList imageList; imageList.Create(32, 32, ILC_COLOR8 | ILC_MASK, RTL_NUMBER_OF(ImageListIcons), 1); for (size_t i = 0; i < RTL_NUMBER_OF(ImageListIcons); ++i) { HICON hIcon = ::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(ImageListIcons[i]) ); // Uncomment this if you want 32x32 icon. // HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(ImageListIcons[i]), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); imageList.AddIcon( hIcon ); } GetTreeControl().SetImageList( imageList, LVSIL_NORMAL); return TRUE; }
LRESULT CFunctionPage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bHandled = TRUE; START_PROFILE(FuncInit); m_MessageMaps.Attach(GetDlgItem(IDC_COMBO_MESSAGEMAP)); m_MessageManager.Init(m_hWnd, m_pResManager, &m_GeneralResources); m_FunctionManager.Init(m_hWnd); CreateControls(); CImageList ImageList; ImageList.Create(16, 16, ILC_COLOR24 | ILC_MASK, 3, 2); ImageList.AddIcon(LoadIcon(_AtlModule.GetResourceInstance(), MAKEINTRESOURCE(IDI_ICON_CLOSE))); ImageList.AddIcon(LoadIcon(_AtlModule.GetResourceInstance(), MAKEINTRESOURCE(IDI_ICON_OPEN))); ImageList.AddIcon(LoadIcon(_AtlModule.GetResourceInstance(), MAKEINTRESOURCE(IDI_ICON_MESSAGE))); ImageList.Add(LoadBitmap(_AtlModule.GetResourceInstance(), MAKEINTRESOURCE(IDB_BITMAP_ICONS)), 0x7C00FF); m_Messages.SetImageList(ImageList.Detach(), TVSIL_NORMAL); FillTreeView(); //построение дерева HTREEITEM hRoot = m_Messages.GetRootItem(); m_Messages.Expand(hRoot); HTREEITEM hRootChild = m_Messages.GetChildItem(hRoot); while(hRootChild) { m_Messages.Expand(hRootChild); hRootChild = m_Messages.GetNextSiblingItem(hRootChild); } CRect r; m_Handlers.GetWindowRect(r); int width = m_WindowSettings.m_HandlerHeaderWidth; //(r.Width() * 5) / 11; m_Handlers.InsertColumn(0, _T("Handler"), LVCFMT_LEFT, width, 0); m_Handlers.InsertColumn(1, _T("Message"), LVCFMT_LEFT, r.Width() - width-5, 1); m_Handlers.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); if (m_pClassVector->GetCount()) { int iCurClass = 0; for (size_t i = 0; i < m_pClassVector->GetCount(); i++) { int iPos = m_ClassCombo.AddString((*m_pClassVector)[i]->Name); m_ClassCombo.SetItemData(iPos, i); if (i == *m_piCurrentClass) iCurClass = iPos; } m_ClassCombo.SetCurSel(iCurClass); UpdateClass(); } LoadGeneralResources(); m_ToolbarImgList.CreateFromImage(IDB_BITMAP_MESSAGE, 18, 6, RGB(197, 200,201), IMAGE_BITMAP, LR_CREATEDIBSECTION); InitToolTip(); m_ToolTip.SetMaxTipWidth(400); if ((int)_AtlModule.m_eWTLVersion < eWTL75) { GetDlgItem(IDC_CHECK_REFLECT_EX).ShowWindow(SW_HIDE); } m_SplitMessages.SetFocus(); END_PROFILE(FuncInit, _T("CFunctionPage::OnInitDialog")); return 0; }