void CSearchParamsWnd::SetAllIcons() { CImageList iml; iml.Create(16, 16, theApp.m_iDfltImageListColorFlags | ILC_MASK, 0, 1); iml.Add(CTempIconLoader(_T("SearchMethod_KadServer"))); iml.Add(CTempIconLoader(_T("SearchMethod_SERVER"))); iml.Add(CTempIconLoader(_T("SearchMethod_GLOBAL"))); iml.Add(CTempIconLoader(_T("SearchMethod_KADEMLIA"))); iml.Add(CTempIconLoader(_T("SearchMethod_FILEDONKEY"))); m_ctlMethod.SetImageList(&iml); m_imlSearchMethods.DeleteImageList(); m_imlSearchMethods.Attach(iml.Detach()); iml.Create(16, 16, theApp.m_iDfltImageListColorFlags | ILC_MASK, 0, 1); iml.Add(CTempIconLoader(_T("SearchFileType_Any"))); iml.Add(CTempIconLoader(_T("SearchFileType_Archive"))); iml.Add(CTempIconLoader(_T("SearchFileType_Audio"))); iml.Add(CTempIconLoader(_T("SearchFileType_CDImage"))); iml.Add(CTempIconLoader(_T("SearchFileType_Picture"))); iml.Add(CTempIconLoader(_T("SearchFileType_Program"))); iml.Add(CTempIconLoader(_T("SearchFileType_Video"))); iml.Add(CTempIconLoader(_T("SearchFileType_Document"))); iml.Add(CTempIconLoader(_T("AABCollectionFileType"))); m_ctlFileType.SetImageList(&iml); m_imlFileType.DeleteImageList(); m_imlFileType.Attach(iml.Detach()); }
void CMuleToolbarCtrl::ChangeToolbarBitmap(const CString& path, bool bRefresh) { bool bResult = false; CImageList ImageList; CEnBitmap Bitmap; if (!path.IsEmpty() && Bitmap.LoadImage(path)) { BITMAP bm = {0}; Bitmap.GetObject(sizeof(bm), &bm); if (bm.bmWidth == NUM_BUTTON_BITMAPS*m_sizBtnBmp.cx && bm.bmHeight == m_sizBtnBmp.cy) { bool bAlpha = bm.bmBitsPixel > 24; if (ImageList.Create(m_sizBtnBmp.cx, bm.bmHeight, bAlpha ? ILC_COLOR32 : (theApp.m_iDfltImageListColorFlags | ILC_MASK), 0, 1)) { ImageList.Add(&Bitmap, bAlpha ? 0xFF000000 : RGB(255, 0, 255)); CImageList* pimlOld = SetImageList(&ImageList); ImageList.Detach(); if (pimlOld) pimlOld->DeleteImageList(); bResult = true; } } Bitmap.DeleteObject(); } // if image file loading or image list creation failed, create default image list. if (!bResult) { // load from icon ressources ImageList.Create(m_sizBtnBmp.cx, m_sizBtnBmp.cy, theApp.m_iDfltImageListColorFlags | ILC_MASK, 0, 1); ImageList.Add(CTempIconLoader(_T("CONNECT"), m_sizBtnBmp.cx, m_sizBtnBmp.cy)); ImageList.Add(CTempIconLoader(_T("DISCONNECT"), m_sizBtnBmp.cx, m_sizBtnBmp.cy)); ImageList.Add(CTempIconLoader(_T("STOPCONNECTING"), m_sizBtnBmp.cx, m_sizBtnBmp.cy)); ImageList.Add(CTempIconLoader(_T("KADEMLIA"), m_sizBtnBmp.cx, m_sizBtnBmp.cy)); ImageList.Add(CTempIconLoader(_T("SERVER"), m_sizBtnBmp.cx, m_sizBtnBmp.cy)); ImageList.Add(CTempIconLoader(_T("TRANSFER"), m_sizBtnBmp.cx, m_sizBtnBmp.cy)); ImageList.Add(CTempIconLoader(_T("SEARCH"), m_sizBtnBmp.cx, m_sizBtnBmp.cy)); ImageList.Add(CTempIconLoader(_T("SharedFiles"), m_sizBtnBmp.cx, m_sizBtnBmp.cy)); ImageList.Add(CTempIconLoader(_T("MESSAGES"), m_sizBtnBmp.cx, m_sizBtnBmp.cy)); ImageList.Add(CTempIconLoader(_T("IRC"), m_sizBtnBmp.cx, m_sizBtnBmp.cy)); ImageList.Add(CTempIconLoader(_T("STATISTICS"), m_sizBtnBmp.cx, m_sizBtnBmp.cy)); ImageList.Add(CTempIconLoader(_T("PREFERENCES"), m_sizBtnBmp.cx, m_sizBtnBmp.cy)); ImageList.Add(CTempIconLoader(_T("TOOLS"), m_sizBtnBmp.cx, m_sizBtnBmp.cy)); ImageList.Add(CTempIconLoader(_T("HELP"), m_sizBtnBmp.cx, m_sizBtnBmp.cy)); ASSERT( ImageList.GetImageCount() == NUM_BUTTON_BITMAPS ); CImageList* pimlOld = SetImageList(&ImageList); ImageList.Detach(); if (pimlOld) pimlOld->DeleteImageList(); } if (bRefresh) { UpdateBackground(); Invalidate(); Refresh(); } }
int CContentsView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CListCtrl::OnCreate(lpCreateStruct) == -1) return -1; ReloadSettings(); // _virtualMode = false; // _sortIndex = 0; _sortID = kpidName; _ascending = true; ListView_SetUnicodeFormat(*this, TRUE); HIMAGELIST hImg = GetSysImageList(true); CImageList *pImgList = CImageList::FromHandlePermanent(hImg); if (pImgList == NULL) { CImageList img; img.Attach(hImg); this->SetImageList(&img, LVSIL_SMALL); img.Detach(); } else this->SetImageList(pImgList, LVSIL_SMALL); hImg = GetSysImageList(false); pImgList = CImageList::FromHandlePermanent(hImg); if (pImgList == NULL) { CImageList img; img.Attach(hImg); this->SetImageList(&img, LVSIL_NORMAL); img.Detach(); } else this->SetImageList(pImgList, LVSIL_NORMAL); CWnd *pParent = GetTopLevelParent(); _dropTargetSpec = new CDropTarget(pParent); _dropTarget = _dropTargetSpec; // ::DragAcceptFiles(hWnd, TRUE); RegisterDragDrop(*pParent, _dropTarget); // _exStyle |= LVS_EX_HEADERDRAGDROP; // DWORD extendedStyle = _listView.GetExtendedListViewStyle(); // extendedStyle |= _exStyle; // _listView.SetExtendedListViewStyle(extendedStyle); // this->SetExtendedStyle(_exStyle); SetTimer(kTimerID, kTimerElapse, NULL); return 0; }
void CDownloadClientsCtrl::Init() { SetName(_T("DownloadClientsCtrl")); CImageList ilDummyImageList; //dummy list for getting the proper height of listview entries ilDummyImageList.Create(1, theApp.GetSmallSytemIconSize().cy,theApp.m_iDfltImageListColorFlags|ILC_MASK, 1, 1); SetImageList(&ilDummyImageList, LVSIL_SMALL); ASSERT( (GetStyle() & LVS_SHAREIMAGELISTS) == 0 ); ilDummyImageList.Detach(); SetExtendedStyle(LVS_EX_FULLROWSELECT); InsertColumn(0, GetResString(IDS_QL_USERNAME), LVCFMT_LEFT, 165); InsertColumn(1, GetResString(IDS_CD_CSOFT), LVCFMT_LEFT, 90); InsertColumn(2, GetResString(IDS_FILE), LVCFMT_LEFT, 235); InsertColumn(3, GetResString(IDS_DL_SPEED), LVCFMT_LEFT, 65); InsertColumn(4, GetResString(IDS_AVAILABLEPARTS), LVCFMT_LEFT, 150); InsertColumn(5, GetResString(IDS_CL_TRANSFDOWN), LVCFMT_LEFT, 115); InsertColumn(6, GetResString(IDS_CL_TRANSFUP), LVCFMT_LEFT, 115); InsertColumn(7, GetResString(IDS_META_SRCTYPE), LVCFMT_LEFT, 60); SetAllIcons(); Localize(); LoadSettings(); // Barry - Use preferred sort order from preferences SetSortArrow(); }
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; }
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; }
void CClientListCtrl::Init() { SetName(_T("ClientListCtrl")); CImageList ilDummyImageList; //dummy list for getting the proper height of listview entries ilDummyImageList.Create(1, theApp.GetSmallSytemIconSize().cy,theApp.m_iDfltImageListColorFlags|ILC_MASK, 1, 1); SetImageList(&ilDummyImageList, LVSIL_SMALL); ASSERT( (GetStyle() & LVS_SHAREIMAGELISTS) == 0 ); ilDummyImageList.Detach(); SetExtendedStyle(LVS_EX_FULLROWSELECT); InsertColumn(0,GetResString(IDS_QL_USERNAME),LVCFMT_LEFT,150,0); InsertColumn(1,GetResString(IDS_CL_UPLOADSTATUS),LVCFMT_LEFT,150,1); InsertColumn(2,GetResString(IDS_CL_TRANSFUP),LVCFMT_LEFT,150,2); InsertColumn(3,GetResString(IDS_CL_DOWNLSTATUS),LVCFMT_LEFT,150,3); InsertColumn(4,GetResString(IDS_CL_TRANSFDOWN),LVCFMT_LEFT,150,4); InsertColumn(5,GetResString(IDS_CD_CSOFT),LVCFMT_LEFT,150,5); InsertColumn(6,GetResString(IDS_CONNECTED),LVCFMT_LEFT,150,6); CString coltemp; coltemp=GetResString(IDS_CD_UHASH);coltemp.Remove(':'); InsertColumn(7,coltemp,LVCFMT_LEFT,150,7); SetAllIcons(); Localize(); LoadSettings(); SetSortArrow(); SortItems(SortProc, GetSortItem()+ (GetSortAscending()? 0:100)); }
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; }
bool CMainFrame::_CreateMeshPanel( CImageList& imageList, Ogre::StringVectorPtr& meshNames ) { if (!m_resourceSelector.Create(WS_CHILD|WS_VISIBLE, CRect(200,100,400,300), this, IDS_ResourceSelector)) return false; m_resourceSelector.SetOwner(this); m_resourceSelector.SetIconSize(CSize(MESH_ICON_SIZE, MESH_ICON_SIZE)); CXTPTaskPanelGroup* pGroup = m_resourceSelector.AddGroup(IDS_ResourceSelector_Mesh); int itemCount = imageList.GetImageCount(); m_resourceSelector.GetImageManager()->SetImageList(imageList.Detach(), 0); for (int i=0; i<itemCount; ++i) { std::wstring meshname(Utility::EngineToUnicode(meshNames->at(i))); meshname.erase(meshname.length()-5); // Add folder entries CXTPTaskPanelGroupItem* pItem = pGroup->AddLinkItem(i, 0); pItem->SetIconIndex(i); pItem->SetCaption(meshname.c_str()); } m_resourceSelector.SetBehaviour(xtpTaskPanelBehaviourList); m_resourceSelector.SetSelectItemOnFocus(TRUE); m_resourceSelector.SetMultiColumn(TRUE); m_resourceSelector.SetColumnWidth(RES_SELECTOR_COLUMN_WIDTH); m_resourceSelector.GetAt(0)->SetExpanded(TRUE); //拖拽支持 m_resourceSelector.AllowDrag(xtpTaskItemAllowDragCopyOutsideControl); return true; }
BOOL CDropDownButton::Init(bool bSingleDropDownBtn, bool bWholeDropDown) { DeleteAllButtons(); m_bSingleDropDownBtn = bSingleDropDownBtn; // If a toolbar control was created indirectly via a dialog resource one can not // add any buttons without setting an image list before. (?) // So, for this to work, we have to attach an image list to the toolbar control! // The image list can be empty, and it does not need to be used at all, but it has // to be attached. CImageList* piml = GetImageList(); if (piml == NULL || piml->m_hImageList == NULL) { CImageList iml; iml.Create(16, 16, ILC_COLOR, 0, 0); SetImageList(&iml); iml.Detach(); } if (m_bSingleDropDownBtn) { TBBUTTON atb[1] = {0}; atb[0].iBitmap = -1; atb[0].idCommand = GetWindowLong(m_hWnd, GWL_ID); atb[0].fsState = TBSTATE_ENABLED; atb[0].fsStyle = m_bSingleDropDownBtn ? (bWholeDropDown ? BTNS_WHOLEDROPDOWN : BTNS_DROPDOWN) : BTNS_BUTTON; atb[0].iString = -1; VERIFY( AddButtons(1, atb) ); ResizeToMaxWidth(); SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS); } 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에서 마지막것만 } }
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; }
void CQueueListCtrl::Init() { SetName(_T("QueueListCtrl")); CImageList ilDummyImageList; //dummy list for getting the proper height of listview entries ilDummyImageList.Create(1, theApp.GetSmallSytemIconSize().cy,theApp.m_iDfltImageListColorFlags|ILC_MASK, 1, 1); SetImageList(&ilDummyImageList, LVSIL_SMALL); ASSERT( (GetStyle() & LVS_SHAREIMAGELISTS) == 0 ); ilDummyImageList.Detach(); SetExtendedStyle(LVS_EX_FULLROWSELECT); InsertColumn(0,GetResString(IDS_QL_USERNAME),LVCFMT_LEFT,150,0); InsertColumn(1,GetResString(IDS_FILE),LVCFMT_LEFT,275,1); InsertColumn(2,GetResString(IDS_FILEPRIO),LVCFMT_LEFT,110,2); InsertColumn(3,GetResString(IDS_QL_RATING),LVCFMT_LEFT,60,3); InsertColumn(4,GetResString(IDS_SCORE),LVCFMT_LEFT,60,4); InsertColumn(5,GetResString(IDS_ASKED),LVCFMT_LEFT,60,5); InsertColumn(6,GetResString(IDS_LASTSEEN),LVCFMT_LEFT,110,6); InsertColumn(7,GetResString(IDS_ENTERQUEUE),LVCFMT_LEFT,110,7); InsertColumn(8,GetResString(IDS_BANNED),LVCFMT_LEFT,60,8); InsertColumn(9,GetResString(IDS_UPSTATUS),LVCFMT_LEFT,100,9); //==>Modversion [shadow2004] #ifdef MODVERSION InsertColumn(10,GetResString(IDS_CLIENTSOFTWARE),LVCFMT_LEFT,100,10); #endif //Modversion //<==Modversion [shadow2004] SetAllIcons(); Localize(); LoadSettings(); // Barry - Use preferred sort order from preferences SetSortArrow(); SortItems(SortProc, GetSortItem() + (GetSortAscending() ? 0:100)); }
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 }
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); }
int CZoneTree::OnCreate(LPCREATESTRUCT lpCreateStruct) { CBitmap bm; CImageList iml; if (CTreeCtrl::OnCreate(lpCreateStruct) == -1) return -1; iml.Create(IDB_TREE_AREA, 16, 0, RGB(255, 0, 0)); bm.LoadBitmap(IDB_TREE_ROOM); iml.Add(&bm, RGB(255, 0, 0)); bm.DeleteObject(); bm.LoadBitmap(IDB_TREE_MOB); iml.Add(&bm, RGB(255, 0, 0)); bm.DeleteObject(); bm.LoadBitmap(IDB_TREE_OBJ); iml.Add(&bm, RGB(255, 0, 0)); bm.DeleteObject(); bm.LoadBitmap(IDB_TREE_MOB_INDEX); iml.Add(&bm, RGB(255, 0, 0)); bm.DeleteObject(); bm.LoadBitmap(IDB_TREE_OBJ_INDEX); iml.Add(&bm, RGB(255, 0, 0)); bm.DeleteObject(); bm.LoadBitmap(IDB_TREE_PEOPLE); iml.Add(&bm, RGB(255, 0, 0)); bm.DeleteObject(); bm.LoadBitmap(IDB_TREE_CONTENTS); iml.Add(&bm, RGB(255, 0, 0)); bm.DeleteObject(); bm.LoadBitmap(IDB_TREE_ROOMS); iml.Add(&bm, RGB(255, 0, 0)); bm.DeleteObject(); bm.LoadBitmap(IDB_TREE_OBJS); iml.Add(&bm, RGB(255, 0, 0)); bm.DeleteObject(); bm.LoadBitmap(IDB_TREE_MOBS); iml.Add(&bm, RGB(255, 0, 0)); bm.DeleteObject(); SetImageList(&iml, TVSIL_NORMAL); iml.Detach(); return 0; }
BOOL CFileWindow::InitDirectoryImageList( CImageList & imglst ) { SHFILEINFO shFinfo; HIMAGELIST hImageList = NULL; hImageList = (HIMAGELIST)SHGetFileInfo( "C:\\", 0, &shFinfo, sizeof( shFinfo ), SHGFI_SYSICONINDEX | SHGFI_SMALLICON ); if ( ! hImageList ) return FALSE; if( imglst.Detach() ) AfxMessageBox( "This should not occur!"); imglst.Attach( hImageList ); return TRUE; }
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 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)); }
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 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 CFileView::OnInitialUpdate() { CListView::OnInitialUpdate(); CListCtrl& list = GetListCtrl(); // 1. 보기 style 결정. list.ModifyStyle( LVS_TYPEMASK,// 제거 style. 기존 style 제거 LVS_REPORT); // Add style. report 보기 적용. // 2. ImageList연결하기. CImageList img; img.Create( IDB_BITMAP1, 16, 1, RGB(255,255,255)); list.SetImageList(&img, LVSIL_SMALL); img.Detach(); img.Create( IDB_BITMAP2, 32, 1, RGB(255,255,255)); list.SetImageList(&img, LVSIL_NORMAL); img.Detach(); //////////////////////////////////////////// // 3. REPORT 보기 일때는 컬럼 헤더 필요. list.InsertColumn(0, "화일", LVCFMT_LEFT, 150); list.InsertColumn(1, "크기", LVCFMT_RIGHT, 150); list.InsertColumn(3, "날짜", LVCFMT_RIGHT, 150); // ListView에 확장 style 넣기. - MSDN에 다양한 style 참고. list.SetExtendedStyle( LVS_EX_HEADERDRAGDROP | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT ); Refresh( "C:\\" ); // 파일을 열거. }
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); }
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); }
void CSharedDirsTreeCtrl::Initalize(CSharedFilesCtrl* pSharedFilesCtrl){ m_pSharedFilesCtrl = pSharedFilesCtrl; SendMessage(CCM_SETUNICODEFORMAT, TRUE); //WORD wWinVer = thePrefs.GetWindowsVersion(); m_bUseIcons = true;/*(wWinVer == _WINVER_2K_ || wWinVer == _WINVER_XP_ || wWinVer == _WINVER_ME_);*/ 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.GetIncomingDir(); if (strTempDir.Right(1) != "\\"){ strTempDir += "\\"; } 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.SetOverlayImage(iml.Add(CTempIconLoader(_T("ClientSecureOvl"))), 1); SetImageList(&iml,TVSIL_NORMAL); 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); InitalizeStandardItems(); FilterTreeReloadTree(); CreateMenues(); }
LRESULT CSearchBarView::OnCreate(LPCREATESTRUCT lpcs) { ATLVERIFY(m_ctrlEditorView.Create(*this, rcDefault, NULL, CHILD_WND_STYLE)); m_ctrlEditorView.ModifyStyle(0, ES_LEFT | ES_AUTOHSCROLL | ES_VERTICAL); // Set up the bitmap buttons. ATLVERIFY(m_btnSearch.Create(*this, rcDefault, NULL, CHILD_WND_STYLE)); CImageList iml; iml.CreateFromImage(IDB_BITMAP3, 40, 0, CLR_NONE, IMAGE_BITMAP, LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS | LR_CREATEDIBSECTION); m_btnSearch.SetImageList(iml.Detach()); m_btnSearch.SetImages(0, 3, 1, 2); m_btnSearch.SetBitmapButtonExtendedStyle(BMPBTN_HOVER, BMPBTN_HOVER); SetMsgHandled(false); return 0; }
void CFriendListCtrl::SetAllIcons() { CImageList iml; iml.Create(16, 16, theApp.m_iDfltImageListColorFlags | ILC_MASK, 0, 1); iml.Add(CTempIconLoader(_T("FriendNoClient"))); iml.Add(CTempIconLoader(_T("FriendWithClient"))); iml.Add(CTempIconLoader(_T("FriendConnected"))); //Xman friend visualization iml.Add(CTempIconLoader(_T("FriendNoClientSlot"))); iml.Add(CTempIconLoader(_T("FriendWithClientSlot"))); iml.Add(CTempIconLoader(_T("FriendConnectedSlot"))); //Xman end ASSERT( (GetStyle() & LVS_SHAREIMAGELISTS) == 0 ); HIMAGELIST himlOld = ApplyImageList(iml.Detach()); if (himlOld) ImageList_Destroy(himlOld); }
void CQueueListCtrl::Init() { static const uint16 s_auColHdr[][2] = { { LVCFMT_LEFT, 150 }, // QLCOL_USERNAME { LVCFMT_LEFT, 275 }, // QLCOL_FILENAME { LVCFMT_LEFT, 110 }, // QLCOL_FILEPRIORITY { LVCFMT_LEFT, 110 }, // QLCOL_PARTS { LVCFMT_LEFT, 110 }, // QLCOL_PROGRESS { LVCFMT_LEFT, 60 }, // QLCOL_QLRATING { LVCFMT_LEFT, 60 }, // QLCOL_SCORE { LVCFMT_LEFT, 60 }, // QLCOL_SFRATIO { LVCFMT_LEFT, 60 }, // QLCOL_RFRATIO { LVCFMT_LEFT, 60 }, // QLCOL_TIMESASKED { LVCFMT_LEFT, 110 }, // QLCOL_LASTSEEN { LVCFMT_LEFT, 110 }, // QLCOL_ENTEREDQUEUE { LVCFMT_LEFT, 60 }, // QLCOL_BANNED { LVCFMT_LEFT, 150 } // QLCOL_COUNTRY }; CImageList ilDummyImageList; ilDummyImageList.Create(1, 17,g_App.m_iDfltImageListColorFlags | ILC_MASK, 1, 1); SetImageList(&ilDummyImageList, LVSIL_SMALL); ilDummyImageList.Detach(); m_iClientFilter = CLI_FILTER_NONE; memzero(m_iColumnMaxWidths, sizeof(m_iColumnMaxWidths)); // Index of the column being measured. -1 for none. m_iMeasuringColumn = -1; SetExtendedStyle(LVS_EX_FULLROWSELECT); for (unsigned ui = 0; ui < ARRSIZE(s_auColHdr); ui++) InsertColumn(ui, _T(""), static_cast<int>(s_auColHdr[ui][0]), static_cast<int>(s_auColHdr[ui][1]), ui); Localize(); LoadSettings(CPreferences::TABLE_QUEUE); SetSortProcedure(SortProc); if (g_App.m_pPrefs->DoUseSort()) SortInit(g_App.m_pPrefs->GetQueueSortCol()); else SortInit(g_App.m_pPrefs->GetColumnSortCode(CPreferences::TABLE_QUEUE)); }
int CShellWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CWnd::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here m_ShellTreeCtrl.Create(WS_CHILD|WS_VISIBLE|TVS_SHOWSELALWAYS|TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT|TVS_TRACKSELECT, CRect(0,0,0,0), this, 100); m_ShellTreeCtrl.ModifyStyleEx(0, WS_EX_CLIENTEDGE); // bring the tooltips to front CWnd* pTT = m_ShellTreeCtrl.FromHandle((HWND) m_ShellTreeCtrl.SendMessage(TVM_GETTOOLTIPS)); if (pTT != NULL) pTT->SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); if (!m_fType.Create(WS_CHILD|WS_VISIBLE|CBS_DROPDOWN|CBS_LOWERCASE, CRect(0,0,0,0), this, ID_SHELLWND_COMBO)) { return -1; // fail to create } //m_fType.ModifyStyleEx(0, WS_EX_CLIENTEDGE); CFont* font = m_ShellTreeCtrl.GetFont(); m_fType.SetFont(font); m_fType.AddString("*.htm;*.html;*.shtm;*.shtml;*.mht;*.txt;"); m_fType.AddString("*.txt;"); m_fType.AddString("*.htm;*.html;"); m_fType.AddString("*.c;*.cpp;*.h;"); m_fType.AddString("*.bmp;*.jpg;*.gif;*.png;"); m_fType.AddString("*.*"); // CImageList img; m_wndRef.CreateEx(this); img.Create(13, 15, ILC_COLORDDB|ILC_MASK, 1, 1); HBITMAP hbmp = ::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_REFRESH)); ImageList_AddMasked(img.GetSafeHandle(), hbmp, RGB(255,0,255)); DeleteObject(hbmp); m_wndRef.GetToolBarCtrl().SetImageList(&img); img.Detach(); m_wndRef.ModifyStyle(0, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT|TBSTYLE_TOOLTIPS ); m_wndRef.SetButtonInfo(0, IDOK, TBSTYLE_BUTTON, 0); m_wndRef.GetToolBarCtrl().GetToolTips()->UpdateTipText(IDS_REFRESH, this, IDOK); return 0; }