void CChatSelector::SetAllIcons() { CImageList iml; iml.Create(16, 16, theApp.m_iDfltImageListColorFlags | ILC_MASK, 0, 1); iml.Add(CTempIconLoader(_T("Chat"))); iml.Add(CTempIconLoader(_T("Message"))); iml.Add(CTempIconLoader(_T("MessagePending"))); SetImageList(&iml); m_imlChat.DeleteImageList(); m_imlChat.Attach(iml.Detach()); SetPadding(CSize(12, 3)); }
// @pymethod int|PyCImageList|Add|Adds an image to the list. PyObject *PyCImageList_Add( PyObject *self, PyObject *args ) { PyObject *obbmp1, *obbmp2; int mask; CImageList *pList = PyCImageList::GetImageList(self); int rc; if (!pList) return NULL; if (PyArg_ParseTuple(args, "(OO)", &obbmp1, &obbmp2)) {// @pyparm (int,int)|bitmap, bitmapMask||2 Bitmaps to use (primary and mask) HBITMAP bmp1, bmp2; if (!PyWinObject_AsHANDLE(obbmp1, (HANDLE *)&bmp1) || !PyWinObject_AsHANDLE(obbmp2, (HANDLE *)&bmp2)) return NULL; if (!IsGdiHandleValid(bmp1) || !IsGdiHandleValid(bmp2)) RETURN_ERR("One of the bitmap handles is invalid"); GUI_BGN_SAVE; rc = pList->Add(CBitmap::FromHandle(bmp1), CBitmap::FromHandle(bmp2)); GUI_END_SAVE; } else { PyErr_Clear(); HBITMAP bmp1; if (PyArg_ParseTuple(args, "Oi", &obbmp1, // @pyparmalt1 int|bitmap||Bitmap to use &mask)) { // @pyparmalt1 int|color||Color to use for the mask. if (!PyWinObject_AsHANDLE(obbmp1, (HANDLE *)&bmp1)) return NULL; if (!IsGdiHandleValid(bmp1)) RETURN_ERR("The bitmap handle is invalid"); GUI_BGN_SAVE; rc = pList->Add(CBitmap::FromHandle(bmp1), (COLORREF)mask); GUI_END_SAVE; } else { PyErr_Clear(); PyObject *obIcon; if (PyArg_ParseTuple(args, "O", &obIcon)) {// @pyparmalt2 int|hIcon||Handle of an icon to add. HICON hIcon; if (!PyWinObject_AsHANDLE(obIcon, (HANDLE *)&hIcon)) return NULL; GUI_BGN_SAVE; rc = pList->Add(hIcon); GUI_END_SAVE; } else { PyErr_Clear(); RETURN_ERR("Add requires '(hbitmap, hbitmap)', 'hbitmap, color' or 'hicon'"); } } } if (rc==-1) RETURN_ERR("Add failed"); return Py_BuildValue("i", rc); // @rdesc Zero-based index of the first new image. }
void CIrcChannelTabCtrl::SetAllIcons() { CImageList imlist; imlist.Create(16, 16, theApp.m_iDfltImageListColorFlags | ILC_MASK, 0, 1); imlist.Add(CTempIconLoader(_T("Chat"))); imlist.Add(CTempIconLoader(_T("Message"))); imlist.Add(CTempIconLoader(_T("MessagePending"))); SetImageList(&imlist); m_imlistIRC.DeleteImageList(); m_imlistIRC.Attach(imlist.Detach()); SetPadding(CSize(10, 3)); }
void CKadSearchListCtrl::SetAllIcons() { CImageList iml; iml.Create(16, 16, theApp.m_iDfltImageListColorFlags | ILC_MASK, 0, 1); iml.Add(CTempIconLoader(_T("KadFileSearch"))); iml.Add(CTempIconLoader(_T("KadWordSearch"))); iml.Add(CTempIconLoader(_T("KadNodeSearch"))); iml.Add(CTempIconLoader(_T("KadStoreFile"))); iml.Add(CTempIconLoader(_T("KadStoreWord"))); ASSERT( (GetStyle() & LVS_SHAREIMAGELISTS) == 0 ); HIMAGELIST himl = ApplyImageList(iml.Detach()); if (himl) ImageList_Destroy(himl); }
void CIrcWnd::SetAllIcons() { CImageList iml; iml.Create(16, 16, theApp.m_iDfltImageListColorFlags | ILC_MASK, 0, 1); iml.Add(CTempIconLoader(_T("Smiley_Smile"))); iml.Add(CTempIconLoader(_T("Bold"))); iml.Add(CTempIconLoader(_T("Underline"))); iml.Add(CTempIconLoader(_T("Colour"))); iml.Add(CTempIconLoader(_T("ResetFormat"))); CImageList* pImlOld = m_wndFormat.SetImageList(&iml); iml.Detach(); if (pImlOld) pImlOld->DeleteImageList(); }
void CKadContactListCtrl::SetAllIcons() { CImageList iml; iml.Create(16,16,theApp.m_iDfltImageListColorFlags|ILC_MASK,0,1); iml.SetBkColor(CLR_NONE); iml.Add(CTempIconLoader(_T("Contact0"))); iml.Add(CTempIconLoader(_T("Contact1"))); iml.Add(CTempIconLoader(_T("Contact2"))); iml.Add(CTempIconLoader(_T("Contact3"))); iml.Add(CTempIconLoader(_T("Contact4"))); ASSERT( (GetStyle() & LVS_SHAREIMAGELISTS) == 0 ); HIMAGELIST himl = ApplyImageList(iml.Detach()); if (himl) ImageList_Destroy(himl); }
BOOL CMediaBrowserPPCDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon CenterWindow(GetDesktopWindow()); // center to the hpc screen // Extra initialization here CCeCommandBar *pCommandBar = (CCeCommandBar*)m_pWndEmptyCB; pCommandBar->InsertMenuBar(IDR_MAINMENU); CImageList* MediaImageList = new CImageList(); MediaImageList->Create(16,16,0,8,8); CBitmap b1; b1.LoadBitmap(IDB_DEVICE2BITMAP); MediaImageList->Add(&b1,RGB(0,0,0)); b1.DeleteObject(); b1.LoadBitmap(IDB_FOLDER1BITMAP); MediaImageList->Add(&b1,RGB(0,0,0)); b1.DeleteObject(); b1.LoadBitmap(IDB_FOLDER1BITMAP); MediaImageList->Add(&b1,RGB(0,0,0)); b1.DeleteObject(); b1.LoadBitmap(IDB_METHODBITMAP); MediaImageList->Add(&b1,RGB(0,0,0)); b1.DeleteObject(); m_MediaList.SetImageList(MediaImageList,LVSIL_SMALL); memset(devices,0,sizeof(void*)*32); this->m_MediaList.InsertItem(0,TEXT("Searching..."),-1); this->m_MediaCombo.AddString(TEXT("Servers")); this->m_MediaCombo.SetCurSel(0); MainDialog = this; CreateThread(NULL,0,&MediaControlPointStart,NULL,0,NULL); return TRUE; // return TRUE unless you set the focus to a control }
void ProgressImages::InitializeProgressImages(CImageList& img, RgbPixel32 background, RgbPixel32 filled, RgbPixel32 unfilled) { m_background = background; m_unfilled = unfilled; m_filled = filled; m_diameter = 14; m_radius = 7; m_pieBlurringSize = 2; m_perimeter = static_cast<int>(GetPI() * m_diameter); m_background = background; m_images.clear(); m_images.reserve(m_perimeter+1); // add 1 for complete coverage, to be on the safe side. m_angles.Resize(m_radius + 1, static_cast<float>(m_perimeter), 0);// the values returned from m_angles will be in the range 0-perimeter, or in other words, 0-m_images.size(). for(m_i = 0; m_i < m_perimeter; m_i ++) { m_bmp = new AnimBitmap<32>(); m_bmp->SetSize(16, 16); m_bmp->Fill(m_background); FilledCircleAAG(8, 8, m_radius, this, &ProgressImages::DrawHLine, this, &ProgressImages::DrawAlphaPixel); // add it to the imagelist. HBITMAP hbm = m_bmp->DetachHandle(); m_images.push_back(img.Add(hbm)); DeleteObject(hbm); delete m_bmp; m_bmp = 0; } }
BOOL CEditButton::Create(CWnd* pWnd, SEARCH_TYPE eType, UINT nMenu) { ASSERT(eType != -1); ASSERT_VALID(pWnd); m_eType = eType; m_nMenu = nMenu; m_pWnd = pWnd; CWnd* pWndParent = m_pWnd->GetParent(); ASSERT_VALID(pWndParent); CRect rc; m_pWnd->GetWindowRect(&rc); m_pWnd->SetWindowPos(NULL, 0, 0, rc.Width()-23, rc.Height(), SWP_NOZORDER|SWP_NOMOVE); pWndParent->ScreenToClient(&rc); rc.left = rc.right-18; DWORD dwStyle = WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_CENTER|BS_VCENTER; switch (m_eType) { case SEARCH_DIRECTORY: case SEARCH_FILE: { if (CButton::Create(_T("..."), dwStyle, rc, pWndParent, GetNextID(pWndParent))) { SetWindowPos(m_pWnd, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE); EnableWindow(m_pWnd->IsWindowEnabled()); SetFont(&m_Font); return TRUE; } } case SEARCH_POPUP: { if (CButton::Create(_T("..."), dwStyle|BS_ICON, rc, pWndParent, GetNextID(pWndParent))) { SetWindowPos(m_pWnd, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE); EnableWindow(m_pWnd->IsWindowEnabled()); SetFont(&m_Font); CImageList imageList; CBitmap bitmap; bitmap.LoadBitmap(IDB_BTN_ARROW); imageList.Create(15, 17, ILC_COLORDDB|ILC_MASK, 1, 1); imageList.Add(&bitmap, RGB(255,0,255)); SetIcon(imageList.ExtractIcon(0)); imageList.Detach(); bitmap.Detach(); return TRUE; } } } return FALSE; }
void CMainFrame::InitializeDefaultPanes(void) { CRect rcClient; this->GetClientRect(&rcClient); CRect rcFloat(0,0,400,200); CRect rcDock(0,0,220,/*rcClient.Width()-200*/200); CRect rcFileTreeDock(0,0,220,10); CRect rcItemListDock(0,0,150,300); CRect rcvgmfileDock(0,0,220,/*rcClient.Width()-200*/300); CRect rcCollListDock(150,150,220,/*rcClient.Width()-200*/100); CRect rcLogListDock(0,0,400,80); //CRect rcDock(); CImageList ilIcons; ilIcons.Create(16, 16, ILC_MASK | ILC_COLOR24, 0, 0); CBitmap bmpIcons; bmpIcons.LoadBitmap(IDB_TAB_ICONS); ilIcons.Add((HBITMAP)bmpIcons, RGB(0,255,0)); HWND hWndFirst = //CreateVGMFilesTreeViewPane(VGMFilesView, _T("Detected VGM Files"), ilIcons.ExtractIcon(10), rcFloat, rcvgmfileDock, NULL); CreateVGMFileListViewPane(theVGMFileListView, _T("Detected Music Files"), ilIcons.ExtractIcon(10), rcFloat, rcvgmfileDock, NULL); CreateFileListViewPane(rawFileListView, _T("Scanned Files"), ilIcons.ExtractIcon(6), rcFloat, rcFileTreeDock, NULL); CreateVGMCollListViewPane(theVGMCollListView, _T("Collections"), ilIcons.ExtractIcon(10), rcFloat, rcCollListDock, NULL); //this->CreatePlainTextOutputPane(m_OutputView, _T("Output"), ilIcons.ExtractIcon(3), rcFloat, rcDock, hWndFirst); //this->CreatePlainTextOutputPane(m_FindResultsView, _T("Find Results 1"), ilIcons.ExtractIcon(11), rcFloat, rcDock, hWndFirst); CreateCollDialogPane(theCollDialog, _T("Coll Info"), rcFloat, rcDock, NULL); CreateLogListViewPane(theLogListView, _T("Logs"), ilIcons.ExtractIcon(10), rcFloat, rcLogListDock, NULL); }
//*************************************************************************************** BOOL CBCGPropertySheet::SetIconsList (UINT uiImageListResID, int cx, COLORREF clrTransparent) { ASSERT_VALID(this); LPCTSTR lpszResourceName = MAKEINTRESOURCE (uiImageListResID); ASSERT(lpszResourceName != NULL); HBITMAP hbmp = (HBITMAP) ::LoadImage ( AfxGetResourceHandle (), lpszResourceName, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); if (hbmp == NULL) { TRACE(_T("Can't load bitmap: %x\n"), uiImageListResID); return FALSE; } CImageList icons; m_bAlphaBlendIcons = FALSE; BITMAP bmpObj; ::GetObject (hbmp, sizeof (BITMAP), &bmpObj); UINT nFlags = (clrTransparent == (COLORREF) -1) ? 0 : ILC_MASK; switch (bmpObj.bmBitsPixel) { case 4: default: nFlags |= ILC_COLOR4; break; case 8: nFlags |= ILC_COLOR8; break; case 16: nFlags |= ILC_COLOR16; break; case 24: nFlags |= ILC_COLOR24; break; case 32: nFlags |= ILC_COLOR32; m_bAlphaBlendIcons = TRUE; break; } icons.Create (cx, bmpObj.bmHeight, nFlags, 0, 0); icons.Add (CBitmap::FromHandle (hbmp), clrTransparent); SetIconsList (icons); return TRUE; }
HICON CXTPIconHandle::ScaleToFit(HICON hIcon, CSize desiredExtent) { if (desiredExtent == CSize(0)) { // invalid arg return NULL; } CSize realExtent = GetExtent(hIcon); if (realExtent == CSize(0)) { // icon destroyed or not created yet return NULL; } // ensure icon retains aspect after scaling int delta = desiredExtent.cx * realExtent.cy - desiredExtent.cy * realExtent.cx; if (delta < 0) { desiredExtent.cy = MulDiv(realExtent.cy, desiredExtent.cx, realExtent.cx); } else if (delta > 0) { desiredExtent.cx = MulDiv(realExtent.cx, desiredExtent.cy, realExtent.cy); } // scale the icon CImageList images; VERIFY(images.Create(desiredExtent.cx, desiredExtent.cy, ILC_COLOR32 | ILC_MASK, 1, 1)); images.Add(hIcon); return images.ExtractIcon(0); }
CPlayerToolBar::CPlayerToolBar() : fDisableImgListRemap(false) , m_pButtonsImages(NULL) , m_hDXVAIcon(NULL) { HBITMAP hBmp = CMPCPngImage::LoadExternalImage(L"gpu", IDB_DXVA_ON, IMG_TYPE::UNDEF); BITMAP bm = { 0 }; ::GetObject(hBmp, sizeof(bm), &bm); if (CMPCPngImage::FileExists(CString(L"gpu")) && (bm.bmHeight > 32 || bm.bmWidth > 32)) { hBmp = CMPCPngImage::LoadExternalImage(L"", IDB_DXVA_ON, IMG_TYPE::UNDEF); ::GetObject(hBmp, sizeof(bm), &bm); } if (bm.bmWidth <= 32 && bm.bmHeight <= 32) { CBitmap *bmp = DNew CBitmap(); bmp->Attach(hBmp); CImageList *pButtonDXVA = DNew CImageList(); pButtonDXVA->Create(bm.bmWidth, bm.bmHeight, ILC_COLOR32 | ILC_MASK, 1, 0); pButtonDXVA->Add(bmp, static_cast<CBitmap*>(NULL)); m_hDXVAIcon = pButtonDXVA->ExtractIcon(0); delete pButtonDXVA; delete bmp; } iDXVAIconHeight = bm.bmHeight; iDXVAIconWidth = bm.bmWidth; DeleteObject(hBmp); }
BOOL CTrueColorToolBar::SetTrueColorToolBar(UINT uToolBarType, UINT uToolBar, int nBtnWidth) { CImageList cImageList; CBitmap cBitmap; BITMAP bmBitmap; if (!cBitmap.Attach(LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(uToolBar), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE|LR_CREATEDIBSECTION)) || !cBitmap.GetBitmap(&bmBitmap)) return FALSE; CSize cSize(bmBitmap.bmWidth, bmBitmap.bmHeight); int nNbBtn = cSize.cx/nBtnWidth; RGBTRIPLE* rgb = (RGBTRIPLE*)(bmBitmap.bmBits); COLORREF rgbMask = RGB(rgb[0].rgbtRed, rgb[0].rgbtGreen, rgb[0].rgbtBlue); if (!cImageList.Create(nBtnWidth, cSize.cy, ILC_COLOR24|ILC_MASK, nNbBtn, 0)) return FALSE; if (cImageList.Add(&cBitmap, rgbMask) == -1) return FALSE; SendMessage(uToolBarType, 0, (LPARAM)cImageList.m_hImageList); cImageList.Detach(); cBitmap.Detach(); return TRUE; }
void CSearchView::CreateTab(CString searchName, UINT cnt, UINT nImage) { // 256 칼라 이상 적용(icon) CImageList imageList; CBitmap bitmap; bitmap.LoadBitmap(IDB_BITMAP_SEARCH_TAB); imageList.Create(16, 16, ILC_COLORDDB | ILC_MASK, 16, 1); imageList.Add(&bitmap, RGB(255, 255, 255)); //m_wndToolBar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList.m_hImageList); // 활성이미지 m_tabSearch.SetImageList(&imageList); imageList.Detach(); bitmap.Detach(); // 처음에 탭내용이 하나도 없으면 탭컨트롤이 안보이게 설정했으므로 탭컨트롤을 보이게 (처음부터 보이면 모양이 이상해짐) m_tabSearch.ShowWindow(TRUE); CString temp; temp.Format("%s [%d]", searchName, cnt); m_tabSearch.InsertItem(m_nTabCnt, temp, nImage); m_tabSearch.SetCurSel(m_nTabCnt - 1); if(cnt == 0 || cnt == m_nTabCnt){ // 버튼클릭으로 생성되거나, OnInitialUpdate에서 마지막것만 } }
void CDocMgr::InitListCtrlEx(void) { CImageList img; img.Create(1, 21, ILC_COLOR8|ILC_MASK,2,2); img.Add(AfxGetApp()->LoadIcon(IDR_MAINFRAME)); m_List.SetImageList(&img,LVSIL_SMALL); m_List.SetExtendedStyle( LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT ); m_List.InsertColumn( ColALIAS, _T("名称"),LVCFMT_LEFT,120); m_List.InsertColumn( ColENCODE, _T("编码"),LVCFMT_LEFT,120); m_List.InsertColumn( ColPAGES, _T("页数"),LVCFMT_LEFT,120); // iPage m_List.InsertColumn( ColSIZE, _T("Size"), LVCFMT_LEFT,0); m_List.InsertColumn( ColTYPE, _T("Type"),LVCFMT_LEFT,0); m_List.InsertColumn( ColTITLE, _T("Title"),LVCFMT_LEFT,0); //m_List.InsertColumn( ColUPDATED, _T("Updated"),LVCFMT_LEFT,0); m_List.InsertColumn( ColEDITION, _T("Edition"),LVCFMT_LEFT,0); m_List.InsertColumn( ColURL, _T("URL"),LVCFMT_LEFT,0); m_List.InsertColumn( ColfURL, _T("fURL"), LVCFMT_LEFT, 0); m_List.InsertColumn( ColProcType, _T("ProcType"), LVCFMT_LEFT, 0); m_List.InsertColumn( ColContent, _T("Content"), LVCFMT_LEFT, 0); //m_List.InsertColumn( ColMossSiteURL, _T("MossSiteURL"), LVCFMT_LEFT, 0); m_List.InsertColumn( ColFolderName, _T("FolderName"), LVCFMT_LEFT, 0); m_List.InsertColumn( ColFileName, _T("FileName"), LVCFMT_LEFT, 0); m_List.InsertColumn( ColIsCopy, _T("IsCopy"),LVCFMT_LEFT,0); m_List.InsertColumn( ColWorkItemID, _T("WorkItemID"),LVCFMT_LEFT,0); m_List.InsertColumn( ColCHKOUT, _T(""),LVCFMT_LEFT,50); //签出按钮列 m_List.InsertColumn( ColCHKIN, _T(""),LVCFMT_LEFT,50); //签入按钮列 //m_List.InsertColumn( ColDELETE, _T(""),LVCFMT_LEFT,50); //删除按钮列 }
int CGuiFrameWnd::InitToolBar(UINT uIDMenu) { if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,CRect(0,0,0,0),uIDMenu) || !m_wndToolBar.LoadToolBar(uIDMenu)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } // new code: Serge Koroleuve IMAGEINFO ii; m_wndToolBar.GetToolBarCtrl().GetImageList()->GetImageInfo(0, &ii); int cx = ii.rcImage.right - ii.rcImage.left; int cy = ii.rcImage.bottom - ii.rcImage.top; int nCount = m_wndToolBar.GetToolBarCtrl().GetImageList()->GetImageCount(); CImageList imageList; CBitmap bitmap; bitmap.LoadBitmap(uIDMenu); imageList.Create(cx, cy, ILC_COLORDDB|ILC_MASK, nCount, 0); imageList.Add(&bitmap, RGB(192,192,192)); m_wndToolBar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList.m_hImageList); imageList.Detach(); bitmap.Detach(); // end of new code return 0; }
BOOL CMainFrame::CreateToolBar() { const DWORD TOOLBAR_STYLE = WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC; // NOTE: LoadToolBar 只能加载 16 色位图, 如果加载 24bit 位图会显示为黑色 if (!m_ToolBar.CreateEx(this, TBSTYLE_FLAT, TOOLBAR_STYLE) || !m_ToolBar.LoadToolBar(ID_TOOLBAR)) { SHOWBMP_TRACE("failed to create toolbar"); return FALSE; } // 为 ToolBar 加载 24bit 位图 CBitmap bmp; BITMAP bm; CImageList imgList; bmp.LoadBitmap(ID_TOOLBAR); bmp.GetBitmap(&bm); imgList.Create(bm.bmHeight, bm.bmHeight, ILC_COLOR24, bm.bmWidth / bm.bmHeight, 0); imgList.Add(&bmp, (CBitmap*) 0); m_ToolBar.GetToolBarCtrl().SetImageList(&imgList); imgList.Detach(); bmp.Detach(); // 使 ToolBar 变为可停靠的 m_ToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_ToolBar); return TRUE; }
inline bool addFile(CListCtrl *lFiles, string filename, __int64 size){ char buffer[16]; HICON ico = NULL; int ico_id; CImageList *imgLst = NULL; if(size >= (__int64)4*1024*1024*1024){ MessageBox(0, loadString(IDS_TOO_BIG_FILE), "KGB Archiver", 0); return false; } ico = getIcon(filename); if(ico != NULL){ imgLst = lFiles->GetImageList(LVSIL_SMALL); if(imgLst == NULL){ imgLst = new CImageList(); imgLst->Create(16, 16, ILC_COLORDDB, 0, INT_MAX); imgLst->SetBkColor(0x00FFFFFF); } ico_id = imgLst->Add(ico); lFiles->SetImageList(imgLst, LVSIL_SMALL); lFiles->InsertItem(lFiles->GetItemCount(), "", ico_id); }else lFiles->InsertItem(lFiles->GetItemCount(), ""); lFiles->SetItemText(lFiles->GetItemCount()-1, 0, filename.c_str()); sprintf(buffer, "%s", convertUnits(size)); lFiles->SetItemText(lFiles->GetItemCount()-1, 1, buffer); return true; }
void CServerWnd::SetAllIcons() { m_ctrlMyInfoFrm.SetIcon(_T("Info")); CImageList iml; iml.Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 1); iml.Add(CTempIconLoader(_T("Log"))); iml.Add(CTempIconLoader(_T("ServerInfo"))); StatusSelector.SetImageList(&iml); m_imlLogPanes.DeleteImageList(); m_imlLogPanes.Attach(iml.Detach()); if (icon_srvlist) VERIFY( DestroyIcon(icon_srvlist) ); icon_srvlist = theApp.LoadIcon(_T("ServerList"), 16, 16); ((CStatic*)GetDlgItem(IDC_SERVLST_ICO))->SetIcon(icon_srvlist); }
int AddBitmapToIList(CImageList& list, UINT bmpID) { CBitmap* bmp=new CBitmap; bmp->LoadBitmap(bmpID); int iRes=list.Add(bmp, RGB(255, 255, 255)); delete bmp; return iRes; }
void CXTPEditListBoxToolBar::Initialize(bool bAutoFont/*= true*/) { // Create the ToolTip control. m_tooltip.Create(this); m_tooltip.Activate(TRUE); CImageList imageList; imageList.Create(14, 12, ILC_COLOR8 | ILC_MASK, 0, 1); CBitmap bmp; CXTPResourceManager::AssertValid(XTPResourceManager()->LoadBitmap(&bmp, XTP_IDB_LISTEDIT)); imageList.Add(&bmp, RGB(255, 0, 255)); for (int i = 0; i < _countof(m_arButton); ++i) { if ((!m_bShowNewDeleteButtons) && ((i==0) || (i==1))) continue; if ((!m_bShowUpDownButtons) && ((i==2) || (i==3))) continue; if (!m_arButton[i].Create(NULL, WS_CHILD | WS_VISIBLE | BS_ICON | BS_CENTER | BS_VCENTER, CRect(0, 0, 0, 0), this, _arButtonID[i])) { TRACE0("Unable to create edit button.\n"); continue; } m_arIcon[i] = imageList.ExtractIcon(i); m_arButton[i].SetIcon(CSize(0), m_arIcon[i]); CString strToolTip; CXTPResourceManager::AssertValid(XTPResourceManager()->LoadString(&strToolTip, _arButtonID[i])); // Add tooltips to group buttons. m_tooltip.AddTool(&m_arButton[i], strToolTip); // make sure the button is Windows XP theme compatible using // the toolbar button theme. if (m_arButton[i].SetTheme(xtpControlThemeFlat)) { CXTPButtonTheme* pTheme = m_arButton[i].GetTheme(); if (pTheme) { pTheme->EnableToolbarStyle(TRUE); } m_arButton[i].SetUseVisualStyle(TRUE); } } // Move the buttons to their correct location. MoveButtons(); // Set the font for this window. if (bAutoFont) { SetFont(&XTPAuxData().font); } }
AFX_INLINE BOOL CreateImageListA(CImageList& il, UINT nID,CDC* m_DC, long sizeImage = 16) { il.Create(sizeImage, sizeImage, ILC_MASK|ILC_COLOR24, 0, 0);//4,1 CBitmap bmp; VERIFY(bmp.LoadBitmap(nID)); il.Add(&bmp,RGB(255,0,255)); return TRUE; }
void CServerListCtrl::SetAllIcons() { CImageList iml; iml.Create(16, 16, theApp.m_iDfltImageListColorFlags | ILC_MASK, 0, 1); iml.Add(CTempIconLoader(_T("Server"))); HIMAGELIST himl = ApplyImageList(iml.Detach()); if (himl) ImageList_Destroy(himl); }
BOOL CConnectDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here m_listServer.m_nType = CONNECTDLG; // 리스트가 지신의 기능만을 처리할수 있는 타입값 m_nClient = 0; // 라디오박스 m_bViewFolder = TRUE; // 폴더공유 UpdateData(false); m_listServer.InsertColumn(0, "", LVCFMT_CENTER, 22); // 이미지 m_listServer.InsertColumn(1, "Server Name", LVCFMT_LEFT, 116); m_listServer.InsertColumn(2, "Server IP", LVCFMT_LEFT, 110); m_listServer.InsertColumn(3, "User ID", LVCFMT_LEFT, 100); m_listServer.InsertColumn(4, "View Folder", LVCFMT_CENTER, 90); m_listServer.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES); // 밑줄나오게 설정 // 256 칼라 이상 적용(icon) CImageList imageList; CBitmap bitmap; bitmap.LoadBitmap(IDB_BITMAP_LIST_LIBRARY_CONNECT); imageList.Create(16, 16, ILC_COLORDDB | ILC_MASK, 16, 1); imageList.Add(&bitmap, RGB(255, 255, 255)); m_listServer.SetImageList(&imageList, LVSIL_SMALL); imageList.Detach(); bitmap.Detach(); /** // listCtrl 에 아이콘 256 칼라 넣기 m_imageList.Create(16, 16, ILC_COLOR8 | ILC_MASK, 16, 1); HICON hIcon = (HICON)::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ICON_LIST_LIBRARY_CONNECT), IMAGE_ICON, SM_CXICON, SM_CYICON, LR_SHARED | LR_LOADTRANSPARENT); m_imageList.Add(hIcon); hIcon = (HICON)::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ICON_LIST_LIBRARY_DISCONNECT), IMAGE_ICON, SM_CXICON, SM_CYICON, LR_SHARED | LR_LOADTRANSPARENT); m_imageList.Add(hIcon); m_listServer.SetImageList(&m_imageList, LVSIL_SMALL); **/ // 파일로드 LoadFile(); // 처음에 데이타가 한개라도 있으면 첫번째 데이타를 보이게 if(m_listServer.GetItemCount() > 0){ m_strServerName = m_listServer.GetItemText(0, 1); m_ipAddressServerIP.SetWindowText(m_listServer.GetItemText(0, 2)); m_strUserID = m_listServer.GetItemText(0, 3); m_bViewFolder = (m_listServer.GetItemText(0, 4) == "YES" ? 1 : 0); UpdateData(FALSE); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
UINT DllWrapper::GetImage(CImageList & il, UINT nID) { CBitmap bmp; HBITMAP hBitmap = LoadBitmap(m_hInstance,MAKEINTRESOURCE(nID)); CBitmap* pBmp = bmp.FromHandle(hBitmap); int ret = il.Add(pBmp,CXTPImageManager::GetBitmapMaskColor(*pBmp, CPoint(0, 0))); return il.GetImageCount(); }
void CKademliaWnd::SetAllIcons() { // frames m_ctrlBootstrap.SetIcon(_T("KadBootstrap")); if (icon_kadsea) VERIFY( DestroyIcon(icon_kadsea) ); icon_kadsea = theApp.LoadIcon(_T("KadCurrentSearches"), 16, 16); ((CStatic*)GetDlgItem(IDC_KADICO2))->SetIcon(icon_kadsea); CImageList iml; iml.Create(16, 16, theApp.m_iDfltImageListColorFlags | ILC_MASK, 1, 1); iml.Add(CTempIconLoader(_T("KadContactList"))); iml.Add(CTempIconLoader(_T("FriendSlot"))); CImageList* pImlOld = m_pbtnWnd->SetImageList(&iml); iml.Detach(); if (pImlOld) pImlOld->DeleteImageList(); }
//------------------------------------------------------------------------ //! Appends the checkbox state images to the list control image list //! //! @param owner The list control adding column //! @param imagelist The image list assigned to the list control //! @return Image index where the two state images (unchecked/checked) was inserted //------------------------------------------------------------------------ int CGridColumnTraitImage::AppendStateImages(CGridListCtrlEx& owner, CImageList& imagelist) { if (!(owner.GetExtendedStyle() & LVS_EX_SUBITEMIMAGES)) owner.SetExtendedStyle(owner.GetExtendedStyle() | LVS_EX_SUBITEMIMAGES); if (!imagelist) imagelist.Create(16, 16, ILC_COLOR16 | ILC_MASK, 1, 0); if (!owner.GetImageList(LVSIL_SMALL)) owner.SetImageList(&imagelist, LVSIL_SMALL); VERIFY( owner.GetImageList(LVSIL_SMALL)==&imagelist ); bool createdStateImages = false; CImageList* pStateList = owner.GetImageList(LVSIL_STATE); if (pStateList==NULL) { if (!(owner.GetExtendedStyle() & LVS_EX_CHECKBOXES)) { createdStateImages = true; owner.SetExtendedStyle(owner.GetExtendedStyle() | LVS_EX_CHECKBOXES); pStateList = owner.GetImageList(LVSIL_STATE); } } int imageCount = -1; ASSERT(pStateList!=NULL); if (pStateList!=NULL) { imageCount = imagelist.GetImageCount(); HICON uncheckedIcon = pStateList->ExtractIcon(0); imagelist.Add(uncheckedIcon); DestroyIcon(uncheckedIcon); HICON checkedIcon = pStateList->ExtractIcon(1); imagelist.Add(checkedIcon); DestroyIcon(checkedIcon); } if (createdStateImages) owner.SetExtendedStyle(owner.GetExtendedStyle() & ~LVS_EX_CHECKBOXES); return imageCount; }
void AddQuestion(HIMAGELIST hmyImageList) { CImageList imgList; // Attach the image list handle to the CImageList object. imgList.Attach(hmyImageList); // Add a new icon to the image list. imgList.Add(AfxGetApp()->LoadStandardIcon(IDI_QUESTION)); // Detach the handle from the CImageList object. imgList.Detach(); }
void CSharedDirsTreeCtrl::SetAllIcons() { CImageList iml; iml.Create(16, 16, theApp.m_iDfltImageListColorFlags | ILC_MASK, 0, 1); iml.Add(CTempIconLoader(_T("ALLFILES"))); // All Directory iml.Add(CTempIconLoader(_T("INCOMPLETE"))); // Temp Directory iml.Add(CTempIconLoader(_T("OPENFOLDER"))); // Incoming Directory iml.Add(CTempIconLoader(_T("CATEGORY"))); // Cats iml.Add(CTempIconLoader(_T("HARDDISK"))); // All Dirs CString strTempDir = thePrefs.GetMuleDirectory(EMULE_INCOMINGDIR); if (strTempDir.Right(1) != "\\"){ strTempDir += "\\"; } //MODIFIED by fengwen on 2007/01/17 <begin> : 提升启动速度 //int nImage = theApp.GetFileTypeSystemImageIdx(strTempDir); // System Folder Icon //if (theApp.GetSystemImageList() != NULL){ // iml.Add(::ImageList_GetIcon(theApp.GetSystemImageList(), nImage, 0)); //} //else{ // iml.Add(CTempIconLoader(_T("OPENFOLDER"))); //} iml.Add(CTempIconLoader(_T("OPENFOLDER"))); //MODIFIED by fengwen on 2007/01/17 <end> : 提升启动速度 iml.SetOverlayImage(iml.Add(CTempIconLoader(_T("ClientSecureOvl"))), 1); SetImageList(&iml, TVSIL_NORMAL); m_imlTree.DeleteImageList(); m_imlTree.Attach(iml.Detach()); COLORREF crBk = GetSysColor(COLOR_WINDOW); COLORREF crFg = GetSysColor(COLOR_WINDOWTEXT); theApp.LoadSkinColorAlt(_T("SharedDirsTvBk"), _T("DefLvBk"), crBk); theApp.LoadSkinColorAlt(_T("SharedDirsTvFg"), _T("DefLvFg"), crFg); SetBkColor(crBk); SetTextColor(crFg); }