本文整理汇总了C++中CImageList类的典型用法代码示例。如果您正苦于以下问题:C++ CImageList类的具体用法?C++ CImageList怎么用?C++ CImageList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CImageList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateImageListA
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;
}
示例2: SetAllIcons
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);
}
示例3: ASSERT
void CSharedDirsTreeCtrl::OnLvnBegindrag(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMTREEVIEW lpnmtv = (LPNMTREEVIEW)pNMHDR;
*pResult = 0;
CDirectoryItem* pToDrag = (CDirectoryItem*)lpnmtv->itemNew.lParam;
if (pToDrag == NULL || pToDrag->m_eItemType != SDI_UNSHAREDDIRECTORY || FileSystemTreeIsShared(pToDrag->m_strFullPath))
return;
ASSERT( m_pDraggingItem == NULL );
delete m_pDraggingItem;
m_pDraggingItem = pToDrag->CloneContent(); // to be safe we store a copy, as items can be deleted when collapsing the tree etc
CImageList* piml = NULL;
POINT ptOffset;
RECT rcItem;
if ((piml = CreateDragImage(lpnmtv->itemNew.hItem)) == NULL)
return;
/* get the bounding rectangle of the item being dragged (rel to top-left of control) */
if (GetItemRect(lpnmtv->itemNew.hItem, &rcItem, TRUE))
{
CPoint ptDragBegin;
int nX, nY;
/* get offset into image that the mouse is at */
/* item rect doesn't include the image */
ptDragBegin = lpnmtv->ptDrag;
ImageList_GetIconSize(piml->GetSafeHandle(), &nX, &nY);
ptOffset.x = (ptDragBegin.x - rcItem.left) + (nX - (rcItem.right - rcItem.left));
ptOffset.y = (ptDragBegin.y - rcItem.top) + (nY - (rcItem.bottom - rcItem.top));
/* convert the item rect to screen co-ords, for use later */
MapWindowPoints(NULL, &rcItem);
}
else
{
GetWindowRect(&rcItem);
ptOffset.x = ptOffset.y = 8;
}
if (piml->BeginDrag(0, ptOffset))
{
CPoint ptDragEnter = lpnmtv->ptDrag;
ClientToScreen(&ptDragEnter);
piml->DragEnter(NULL, ptDragEnter);
}
delete piml;
/* set the focus here, so we get a WM_CANCELMODE if needed */
SetFocus();
/* redraw item being dragged, otherwise it remains (looking) selected */
InvalidateRect(&rcItem, TRUE);
UpdateWindow();
/* Hide the mouse cursor, and direct mouse input to this window */
SetCapture();
}
示例4: UpdateData
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
}
示例5: GetImageList
void CDirectoryTreeCtrl::OnDestroy()
{
// If a treeview control is created with TVS_CHECKBOXES, the application has to
// delete the image list which was implicitly created by the control.
CImageList *piml = GetImageList(TVSIL_STATE);
if (piml)
piml->DeleteImageList();
CTreeCtrl::OnDestroy();
}
示例6: GetImage
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();
}
示例7: Py_BuildValue
// @pymethod int|PyCImageList|GetImageCount|Retrieves the number of images in an image list.
PyObject *PyCImageList_GetImageCount( PyObject *self, PyObject *args )
{
CImageList *pList;
if (!(pList=PyCImageList::GetImageList(self)))
return NULL;
CHECK_NO_ARGS2(args, "GetImageCount");
GUI_BGN_SAVE;
int rc = pList->GetImageCount();
GUI_END_SAVE;
return Py_BuildValue("i", rc);
}
示例8: InitItem
BOOL CEmptyProjectTemplateItem::InitItem(LPCTSTR lpszPath, CImageList &ImageList32, CImageList &ImageList16)
{
UNUSED_ALWAYS(lpszPath);
//add image to image list and remember index
HICON hIcon = theApp.LoadIcon(IDR_LATEXDOCTYPE);
m_nImageIndex = hIcon ? ImageList32.Add(hIcon) : -1;
ImageList16.Add(hIcon);
return TRUE;
}
示例9: InitDirectoryImageList
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;
}
示例10: CImageList
void CTaskSwitcher32Dlg::FilterList()
{
m_windowList2.DeleteAllItems();
window_list *list = window_item::get_window_list();
CImageList *pImageList = new CImageList(); pImageList->Create( 16, 16, ILC_COLOR32 | ILC_MASK | ILC_PERITEMMIRROR, 0, 10);
m_windowList2.SetImageList( pImageList, LVSIL_SMALL);
int default_idx = pImageList->Add( m_hIcon );
for ( unsigned int i = 0; i < list->size(); i++ )
{
window_item *item = (*list)[i];
bool ok = true;
if ( this->search.length() > 0 )
{
int pos = item->get_lower_title().find( this->search ) ;
int pos2 = item->get_process_name().find( this->search );
if ( pos == std::string::npos && pos2 == std::string::npos )
ok = false;
}
if ( ok )
{
HWND hwnd = item->get_handle();
HICON hIcon = NULL;
SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
if (!hIcon) SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
if (!hIcon) SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
if (!hIcon) hIcon = (HICON)GetClassLong(hwnd, GCL_HICON);
if (!hIcon) hIcon = (HICON)GetClassLong(hwnd, GCL_HICONSM);
int imageidx = -1;
if ( hIcon != NULL )
{
HICON iconCopy = CopyIcon( hIcon );
imageidx = pImageList->Add( iconCopy );
DestroyIcon( iconCopy );
}
else
{
imageidx = 1;
}
int idx = m_windowList2.InsertItem( 0, item->get_title().c_str(), imageidx );
m_windowList2.SetItem( idx, 1, LVIF_TEXT | LVIF_IMAGE, item->get_process_name().c_str(), imageidx, 0, 0, 0 );
m_windowList2.SetItemData( idx, (DWORD_PTR) item );
}
}
m_windowList2.SetItemState( 0, LVIS_SELECTED, LVIS_SELECTED );
m_windowList2.SetSelectionMark( 0 );
}
示例11: IdentifyListDataModel
LRESULT IdentifyView::onCreate(LPCREATESTRUCT createStruct)
{
RECT myRect = { 0, 0, createStruct->cx, createStruct->cy };
//RECT identRect = { 0, 0, 250, createStruct->cy };
//RECT gridRect = { 250, 0, createStruct->cx, createStruct->cy };
DWORD splitterStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
// Create child windows
m_splitter.Create(m_hWnd, myRect, NULL, splitterStyle);
m_splitter.SetSplitterExtendedStyle(0);
m_splitter.SetDlgCtrlID(IDW_SPLITTER);
DWORD gridStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_OWNERDATA;
m_identifyList->Create(m_splitter.m_hWnd, rcDefault, NULL, gridStyle, WS_EX_CLIENTEDGE);
m_identifyList->SetDlgCtrlID(IDW_IDENTLIST);
m_datagrid->Create(m_splitter.m_hWnd, rcDefault, NULL, gridStyle, WS_EX_CLIENTEDGE);
m_datagrid->SetDlgCtrlID(IDW_DATAGRID);
m_splitter.SetSplitterPanes(m_identifyList->m_hWnd, m_datagrid->m_hWnd);
m_splitter.SetActivePane(SPLIT_PANE_LEFT);
m_splitter.SetSplitterPos(250);
// Assign a datamodel to the list of identifyables.
m_identifyListModel.reset(new IdentifyListDataModel(m_db));
m_identifyList->setModel(m_identifyListModel);
m_identifyList->autosizeColumnsUseData();
DlgResize_Init(false, false);
// Build the toolbar
TBBUTTON buttons[1];
buttons[0].iBitmap = 0;
buttons[0].idCommand = ID_HELP;
buttons[0].fsState = TBSTATE_ENABLED;
buttons[0].fsStyle = TBSTYLE_BUTTON | BTNS_SHOWTEXT | BTNS_AUTOSIZE;
buttons[0].dwData = NULL;
buttons[0].iString = (INT_PTR)_T("Help");
CImageList imageList;
imageList.CreateFromImage(IDB_IDENTIFY_VIEW, 16, 1, CLR_DEFAULT, IMAGE_BITMAP, LR_CREATEDIBSECTION | LR_DEFAULTSIZE);
m_toolbar.Create(GetTopLevelWindow(), NULL, _T("IdentifyViewToolBar"),
ATL_SIMPLE_TOOLBAR_PANE_STYLE | TBSTYLE_LIST,
TBSTYLE_EX_MIXEDBUTTONS);
m_toolbar.SetButtonStructSize();
m_toolbar.SetImageList(imageList);
m_toolbar.AddButtons(ARRAYSIZE(buttons), buttons);
m_toolbar.AutoSize();
return 0;
}
示例12: CImageList
BOOL CEmoticonDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CImageList* pImageList = new CImageList();
pImageList->Create(32, 32, ILC_COLOR16, 0, 1);
m_listEmoticon.SetImageList(pImageList, LVSIL_NORMAL);
LoadEmoticons();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例13: AddQuestion
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();
}
示例14: OnDestroy
/////////////////////////////////////////////////////////////////////////////
// CMyTreeCtrl message handlers
void CMyTreeCtrl::OnDestroy()
{
CImageList *pimagelist;
pimagelist = GetImageList(TVSIL_NORMAL);
if( pimagelist )
pimagelist->DeleteImageList();
delete pimagelist;
pimagelist = GetImageList(TVSIL_STATE);
if( pimagelist )
pimagelist->DeleteImageList();
delete pimagelist;
}
示例15: OnSetImageList
LRESULT CSHeaderCtrl::OnSetImageList(WPARAM, LPARAM lParam)
{
CImageList* pImageList;
pImageList = CImageList::FromHandle((HIMAGELIST)lParam);
IMAGEINFO info;
if (pImageList->GetImageInfo(0, &info))
{
m_sizeImage.cx = info.rcImage.right - info.rcImage.left;
m_sizeImage.cy = info.rcImage.bottom - info.rcImage.top;
}
return Default();
}