void CTreeView::OnDestroy() { RemoveImageList(LVSIL_NORMAL); RemoveImageList(LVSIL_STATE); CCtrlView::OnDestroy(); }
void CListView::OnNcDestroy() { RemoveImageList(LVSIL_NORMAL); RemoveImageList(LVSIL_SMALL); RemoveImageList(LVSIL_STATE); CCtrlView::OnNcDestroy(); }
//-------------------------------------------------------------------// // RefreshImages() // //-------------------------------------------------------------------// // This is called during palette changes to reload images. //-------------------------------------------------------------------// void OleListCtrl::RefreshImages() { RemoveImageList( LVSIL_NORMAL ); ObjectImages.DeleteImageList(); RemoveImageList( LVSIL_SMALL ); SmallObjectImages.DeleteImageList(); AddImages(); Invalidate(); }
void CTreeCtrl::OnDestroy() { RemoveImageList(LVSIL_NORMAL); RemoveImageList(LVSIL_STATE); }
void CPageNavigator::ActivateNewDoc(CAGDoc* pAGDoc, int nDefaultPage) { if (!m_hWnd) return; m_pAGDoc = pAGDoc; m_nPage = -1; // Stop all window updates to avoid flickering SetRedraw(false); // Remove any previously loaded items from the list control DeleteAllItems(); // Detach the image list from the list control RemoveImageList(LVSIL_NORMAL); // Destroy the image list m_ImageList.Destroy(); // Get out if no document to attach to if (!m_pAGDoc) return; ::SendMessage(m_hWnd, LVM_SETBKCOLOR, (WPARAM)0, (LPARAM)(COLORREF)RGB(241,243,245)); // Re-create the image list at the proper size bool bPortrait = m_pAGDoc->IsPortrait(); m_dxIcon = THUMBNAIL_WT; m_dyIcon = THUMBNAIL_HT; bool bOK = !!m_ImageList.Create(m_dxIcon, m_dyIcon, ILC_COLOR24, 1/*nInitial*/, 1/*nGrow*/); // Determine the document appropriate images to add to the image list AGDOCTYPE DocType = m_pAGDoc->GetDocType(); int nImages = 0; int* pidList1 = NULL; int* pidList2 = NULL; m_bIsCard = false; switch (DocType) { case DOC_BANNER: case DOC_BROCHURE: case DOC_BUSINESSCARD: case DOC_CDLABEL: case DOC_ENVELOPE: case DOC_FULLSHEET: case DOC_LABEL: case DOC_POSTCARD: case DOC_IRONON: case DOC_GIFTNAMECARD: case DOC_TRIFOLD: case DOC_HOLIDAYCARD: case DOC_PHOTOCARD: default: { nImages = (bPortrait ? sizeof(idList_PortraitPages1) : sizeof(idList_LandscapePages1)) / sizeof(int); pidList1 = (bPortrait ? idList_PortraitPages1 : idList_LandscapePages1); pidList2 = (bPortrait ? idList_PortraitPages2 : idList_LandscapePages2); m_bIsCard = false; break; } case DOC_HALFCARD: case DOC_QUARTERCARD: case DOC_NOTECARD: case DOC_CDBOOKLET: { nImages = (bPortrait ? sizeof(idList_PortraitCards1) : sizeof(idList_LandscapeCards1)) / sizeof(int); pidList1 = (bPortrait ? idList_PortraitCards1 : idList_LandscapeCards1); pidList2 = (bPortrait ? idList_PortraitCards2 : idList_LandscapeCards2); m_bIsCard = true; break; } } int nPages = m_pAGDoc->GetNumPages(); // Add the document appropriate images to the image list for (int nPass = 0; nPass < 2; nPass++) { for (int i = 0; i < nPages; i++) { int iIcon = (i < nImages ? i : nImages-1); int* pidList = (nPass == 0 ? pidList1 : pidList2); CImage Image(_AtlBaseModule.GetResourceInstance(), pidList[iIcon], "GIF"); HBITMAP hBitmap = Image.GetBitmapHandle(); //j HBITMAP hBitmap = ::LoadBitmap(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(pidList[iIcon])); if (!m_bIsCard) { CString strNumber; strNumber.Format("%d", i+1); DrawTextOnBitmap(hBitmap, strNumber, 16, RGB(0,0,0), 0, 2); } else if (i >= 4) { CString strNumber; strNumber.Format("+%d", i-3); DrawTextOnBitmap(hBitmap, strNumber, 16, RGB(0,0,0), 0, 2); } m_ImageList.Add(hBitmap); //j ::DeleteObject(hBitmap); } } // Attach the image list to the list control SetImageList(m_ImageList, LVSIL_NORMAL); // Set the icon spacing arbitrarily large to ensure that our icons are placed where we want them SetIconSpacing(1000, 1000); // Compute the spacing required on the top RECT ClientRect = {0,0,0,0}; GetClientRect(&ClientRect); m_yTop = (HEIGHT(ClientRect) - m_dyIcon) / 2; // Compute the spacing required on the left if (!m_bIsCard) m_xLeft = 2; else { int nIcons = 4; //(bPortrait ? 4 : 3); m_xLeft = (WIDTH(ClientRect) - (nIcons * m_dxIcon) - (2 * THUMBNAIL_GAP)) / 2; } // Insert the new list items int xLocation = m_xLeft; for (int i = 0; i < nPages; i++) { InsertItem(i/*nItem*/, "", i/*nImage*/); // shift the thumbnail to desired position int yCorrection = 0; POINT pt = {xLocation, m_yTop + yCorrection}; SetItemPosition(i, pt); xLocation += (m_dxIcon + THUMBNAIL_GAP); } SelectPage(nDefaultPage, true/*bSetState*/); SetRedraw(true); }