当前位置: 首页>>代码示例>>C++>>正文


C++ TreeView_SetImageList函数代码示例

本文整理汇总了C++中TreeView_SetImageList函数的典型用法代码示例。如果您正苦于以下问题:C++ TreeView_SetImageList函数的具体用法?C++ TreeView_SetImageList怎么用?C++ TreeView_SetImageList使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TreeView_SetImageList函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initTreeViewImageLists

BOOL initTreeViewImageLists() 
{
    HIMAGELIST	himl;  // handle cua image list 
	//HIMAGELIST	himl2;  // handle cua image list 
	SHFILEINFO	psfi;

    // Tao image list.
	// Tai sao Icon lai xau nhu vay
	if ((himl = ImageList_Create(16, 16, 
		ILC_COLOR32, NUM_ICONS, 1000)) == NULL) 
        return FALSE; 
	
//	if ((himl2 = ImageList_Create(16, 16, 
//		ILC_COLORDDB | ILC_MASK, NUM_ICONS, 1000)) == NULL) 
  //      return FALSE;
    // Add cac icon vao Image list
//	SHGetFileInfo(_T("C:\\"), 0, &psfi, sizeof ( SHFILEINFO ), SHGFI_ICON);
//	ImageList_AddIcon(himl, psfi.hIcon);
    // Neu so bitmap add vao < NUM_BITMAPS -> Error
//    if (ImageList_GetImageCount(himl) < NUM_ICONS) 
//        return FALSE; 

    // Gan image list cho Tree View control. 
	TreeView_SetImageList(hwndTreeView, himl, TVSIL_NORMAL); 
	TreeView_SetImageList(hwndTreeView, himl, TVSIL_STATE); 
    return TRUE; 
} 
开发者ID:anhvinhitus,项目名称:myprojects2005-2009,代码行数:27,代码来源:stdafx.cpp

示例2: wbCreateTreeViewImageList

BOOL wbCreateTreeViewImageList(PWBOBJ pwbo, HBITMAP hbmImage, int nImages, COLORREF clTransparent)
{
	HBITMAP hbmMask;
	static HIMAGELIST hi;
	BITMAP bm;

	if(!pwbo || !pwbo->hwnd || !IsWindow(pwbo->hwnd))
		return FALSE;

	if(hbmImage && nImages) {

		GetObject(hbmImage, sizeof(BITMAP), (LPSTR) &bm);
		if((bm.bmWidth == 0) | (bm.bmHeight == 0))
			return FALSE;

		nImages = MAX(1, MIN(nImages, MIN(bm.bmWidth, MAX_IMAGELIST_IMAGES)));

		if(clTransparent != NOCOLOR) {
			hbmMask = wbCreateMask(hbmImage, clTransparent);
			hi = ImageList_Create(bm.bmWidth / nImages, bm.bmHeight, ILC_COLORDDB | ILC_MASK, nImages, 0);
			ImageList_Add(hi, hbmImage, hbmMask);
			TreeView_SetImageList(pwbo->hwnd, hi, TVSIL_NORMAL);
			DeleteObject(hbmMask);
		} else {
			hi = ImageList_Create(bm.bmWidth / nImages, bm.bmHeight, ILC_COLORDDB, nImages, 0);
			ImageList_Add(hi, hbmImage, NULL);
			TreeView_SetImageList(pwbo->hwnd, hi, TVSIL_NORMAL);
		}
	} else {
		TreeView_SetImageList(pwbo->hwnd, NULL, TVSIL_NORMAL);
		ImageList_Destroy(hi);
	}
	return TRUE;
}
开发者ID:Darksynx,项目名称:WinBinder,代码行数:34,代码来源:wb_control_treeview.c

示例3: TreeView_SetImageList

CATResult CATTreeCtrl::UseImageList(CATUInt32 imageListId, CATUInt32 width, const CATColor& transparent)
{
    if (fImageList)
    {
        TreeView_SetImageList(fControlWnd, 0,TVSIL_NORMAL);
        ImageList_Destroy(fImageList);
        fImageList = 0;
    }

    if (imageListId == 0)
    {
        return CAT_SUCCESS;
    }

    const int kMaxNumImageListItems = 16;

    fImageList = ImageList_LoadBitmap(	gApp->GetInstance(),
                                        MAKEINTRESOURCE(imageListId),
                                        width,
                                        kMaxNumImageListItems,
                                        RGB(transparent.r, transparent.g, transparent.b));

    if (fImageList != 0)
    {
        TreeView_SetImageList(fControlWnd, fImageList, TVSIL_NORMAL);
        return CAT_SUCCESS;
    }

    return CATRESULT(CAT_ERR_IMAGELIST_FAILED);
}
开发者ID:michaelellison,项目名称:Mike-s-Demo-App,代码行数:30,代码来源:CATTreeCtrl_Win32.cpp

示例4: TreeView_SetImageList

void ShellBrowserChild::invalidate_cache()
{
	TreeView_SetImageList(_left_hwnd, 0, TVSIL_NORMAL);
	ImageList_Destroy(_himl);

	TreeView_SetImageList(_left_hwnd, _himl, TVSIL_NORMAL);
	_himl = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK|ILC_COLOR24, 2, 0);

	_image_map.clear();
	_image_map_open.clear();
}
开发者ID:svn2github,项目名称:ros-explorer,代码行数:11,代码来源:shellbrowser.cpp

示例5: ImageList_Destroy

void ShellBrowser::invalidate_cache()
{
    (void)TreeView_SetImageList(_left_hwnd, _himl_old, TVSIL_NORMAL);
    ImageList_Destroy(_himl);

    _himl = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK|ILC_COLOR24, 2, 0);
    ImageList_SetBkColor(_himl, GetSysColor(COLOR_WINDOW));

    _himl_old = TreeView_SetImageList(_left_hwnd, _himl, TVSIL_NORMAL);

    for(map<int,int>::const_iterator it=_image_map.begin(); it!=_image_map.end(); ++it)
        g_Globals._icon_cache.free_icon(it->first);

    _image_map.clear();
}
开发者ID:svn2github,项目名称:ros-explorer,代码行数:15,代码来源:shellbrowser.cpp

示例6: CreateImageList

void CreateImageList(HWND hWnd)
{
	// Create and populate image list
	HIMAGELIST hImList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),	ILC_MASK | ILC_COLOR32, nProtocol, 0);

	NudgeElementList *n;
	for(n = NudgeList;n != NULL; n = n->next)
	{
		HICON hIcon = NULL;
		hIcon=(HICON)CallProtoService(n->item.ProtocolName, PS_LOADICON,PLI_PROTOCOL | PLIF_SMALL, 0);
		if (hIcon == NULL || (int)hIcon == CALLSERVICE_NOTFOUND) 
		{
			hIcon=(HICON)CallProtoService(n->item.ProtocolName, PS_LOADICON, PLI_PROTOCOL, 0);
		}
 
		if (hIcon == NULL || (int)hIcon == CALLSERVICE_NOTFOUND) 
			hIcon = (HICON) LoadImage(hInst, MAKEINTRESOURCE(IDI_NUDGE), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);

		ImageList_AddIcon(hImList, hIcon);
		DestroyIcon(hIcon);
	}
	//ADD default Icon for nudge
	HICON hIcon = NULL;
	hIcon = (HICON) LoadImage(hInst, MAKEINTRESOURCE(IDI_NUDGE), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
	ImageList_AddIcon(hImList, hIcon);
	DestroyIcon(hIcon);

	HWND hLstView = GetDlgItem(hWnd, IDC_PROTOLIST);
	TreeView_SetImageList(hLstView, hImList, TVSIL_NORMAL);
}
开发者ID:BackupTheBerlios,项目名称:mgoodies-svn,代码行数:30,代码来源:options.cpp

示例7: Create

    //
    // Public Functions
    //
    bool Create(DWORD_PTR dwStyleEx, DWORD_PTR dwStyle, INT_PTR x, INT_PTR y, INT_PTR cx,
                INT_PTR cy, HWND hWndParent, INT_PTR iID, HINSTANCE hInst)
    {
        bool r = false;

        if (m_ImgList.Create(TV_DEFICONX, TV_DEFICONY, ILC_COLOR32 | ILC_MASK, 1, 1, hInst)) {

            Window::Create(dwStyleEx,
                           WC_TREEVIEW,
                           _T(""),
                           dwStyle,
                           x,
                           y,
                           cx,
                           cy,
                           hWndParent,
                           iID,
                           hInst);

            if (NULL != m_hWnd) {

                TreeView_SetImageList(m_hWnd, m_ImgList.Handle(), TVSIL_NORMAL);
                r = true;

            }

        }

        return r;
    }
开发者ID:ryanlederman,项目名称:wlib,代码行数:33,代码来源:treeview.hpp

示例8: CreateTreeIcons

// create iconlist and Treeview control
static BOOL CreateTreeIcons()
{
	HICON	hIcon;
	INT 	i;
	HINSTANCE hInst = GetModuleHandle(0);

	int numIcons = ICON_MAX + numExtraIcons;

	hTreeSmall = ImageList_Create (16, 16, ILC_COLORDDB | ILC_MASK, numIcons, numIcons);

	//dprintf("Trying to load %i normal icons",ICON_MAX);
	for (i = 0; i < ICON_MAX; i++)
	{
		hIcon = LoadIconFromFile(treeIconNames[i].lpName);
		if (!hIcon)
			hIcon = LoadIcon(hInst, MAKEINTRESOURCE(treeIconNames[i].nResourceID));

		if (ImageList_AddIcon (hTreeSmall, hIcon) == -1)
		{
			ErrorMsg("Error creating icon on regular folder, %i %i",i,hIcon != NULL);
			return FALSE;
		}
	}

	//dprintf("Trying to load %i extra custom-folder icons",numExtraIcons);
	for (i = 0; i < numExtraIcons; i++)
	{
		if ((hIcon = LoadIconFromFile(ExtraFolderIcons[i])) == 0)
			hIcon = LoadIcon (hInst, MAKEINTRESOURCE(IDI_FOLDER));

		if (ImageList_AddIcon(hTreeSmall, hIcon) == -1)
		{
			ErrorMsg("Error creating icon on extra folder, %i %i",i,hIcon != NULL);
			return FALSE;
		}
	}

	// Be sure that all the small icons were added.
	if (ImageList_GetImageCount(hTreeSmall) < numIcons)
	{
		ErrorMsg("Error with icon list--too few images.  %i %i",
				ImageList_GetImageCount(hTreeSmall),numIcons);
		return FALSE;
	}

	// Be sure that all the small icons were added.

	if (ImageList_GetImageCount (hTreeSmall) < ICON_MAX)
	{
		ErrorMsg("Error with icon list--too few images.  %i < %i",
				 ImageList_GetImageCount(hTreeSmall),ICON_MAX);
		return FALSE;
	}

	// Associate the image lists with the list view control.
	TreeView_SetImageList(GetTreeView(), hTreeSmall, TVSIL_NORMAL);

	return TRUE;
}
开发者ID:Bremma,项目名称:pinmame,代码行数:60,代码来源:TreeView.c

示例9: On_DlgCfgInitDialog

// 对话框消息处理函数
BOOL On_DlgCfgInitDialog(HWND hdlgP, HWND hwndFocus, LPARAM lParam)
{
	HWND hctl = GetDlgItem(hdlgP, IDC_TV_CFG_EXPLORER);

	gdmgr._hdlg_visual = hdlgP;

	TreeView_SetImageList(hctl, gdmgr._himl, TVSIL_NORMAL);

	return FALSE;
}
开发者ID:SkyPrayerStudio,项目名称:War-Of-Kingdom,代码行数:11,代码来源:DlgVisualProc.cpp

示例10: hTreeView

CCList::CCList(HWND hTreeView) : 
	hTreeView(hTreeView), 
	ExtraImageList(nullptr)
{
	CWndUserData(GetParent(hTreeView)).SetCList(this);
	OrigTreeViewProc = (WNDPROC)SetWindowLongPtr(hTreeView, GWLP_WNDPROC, (LONG_PTR)ContactListSubclassProc);
	OrigParentProc = (WNDPROC)SetWindowLongPtr(GetParent(hTreeView), GWLP_WNDPROC, (LONG_PTR)ParentSubclassProc);
	TreeView_SetImageList(hTreeView, Clist_GetImageList(), TVSIL_NORMAL);
	WindowList_Add(hCLWindowList, hTreeView, NULL);
	TreeView_SetIndent(hTreeView, 5); // doesn't set it less than the initial value on my system, and i guess it's because of icons... but who knows - maybe it will work somewhere
}
开发者ID:tweimer,项目名称:miranda-ng,代码行数:11,代码来源:ContactList.cpp

示例11: _ASSERT

void CCList::SetInfoIcon(HTREEITEM hItem, HICON hIcon)
{
	_ASSERT(hItem && hIcon && GetItemType(hItem) == MCLCIT_INFO);
	TVITEM tvi = { 0 };
	tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
	tvi.hItem = hItem;
	HIMAGELIST iml = TreeView_GetImageList(hTreeView, TVSIL_NORMAL);
	tvi.iImage = tvi.iSelectedImage = ImageList_AddIcon(iml, hIcon); // again, we don't check for duplicate icons
	TreeView_SetImageList(hTreeView, iml, TVSIL_NORMAL);
	TreeView_SetItem(hTreeView, &tvi);
}
开发者ID:tweimer,项目名称:miranda-ng,代码行数:11,代码来源:ContactList.cpp

示例12: RGB

BOOL AnimatorBar::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_Images.Create(16, 16, ILC_COLOR24|ILC_MASK, 0, 0);
	CBitmap bm;
	bm.LoadBitmap(IDB_ANIMICONS);
	m_Images.Add(&bm, RGB(0, 0, 0));

	TreeView_SetImageList(animations, m_Images, TVSIL_NORMAL);

	return TRUE;
}
开发者ID:aolko,项目名称:construct,代码行数:13,代码来源:Animator+Bar.cpp

示例13: RGB

BOOL FunctionListPanel::setTreeViewImageList(int root_id, int node_id, int leaf_id)
{
	HBITMAP hbmp;
	COLORREF maskColour = RGB(192, 192, 192);
	const int nbBitmaps = 3;

	// Creation of image list
	if ((_hTreeViewImaLst = ImageList_Create(CX_BITMAP, CY_BITMAP, ILC_COLOR32 | ILC_MASK, nbBitmaps, 0)) == NULL) 
		return FALSE;

	// Add the bmp in the list
	hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(root_id));
	if (hbmp == NULL)
		return FALSE;
	ImageList_AddMasked(_hTreeViewImaLst, hbmp, maskColour);
	DeleteObject(hbmp);

	hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(node_id));
	if (hbmp == NULL)
		return FALSE;
	ImageList_AddMasked(_hTreeViewImaLst, hbmp, maskColour);
	DeleteObject(hbmp);

	hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(leaf_id));
	if (hbmp == NULL)
		return FALSE;
	ImageList_AddMasked(_hTreeViewImaLst, hbmp, maskColour);
	DeleteObject(hbmp);

	if (ImageList_GetImageCount(_hTreeViewImaLst) < nbBitmaps)
		return FALSE;

	// Set image list to the tree view
	TreeView_SetImageList(_treeView.getHSelf(), _hTreeViewImaLst, TVSIL_NORMAL);
	TreeView_SetImageList(_treeViewSearchResult.getHSelf(), _hTreeViewImaLst, TVSIL_NORMAL);

	return TRUE;
}
开发者ID:AndersBillLinden,项目名称:nppcr_npp,代码行数:38,代码来源:functionListPanel.cpp

示例14: ViewDlg_OnInitDialog

static BOOL
ViewDlg_OnInitDialog(HWND hwndDlg)
{
    HWND hwndTreeView = GetDlgItem(hwndDlg, IDC_VIEW_TREEVIEW);

    s_hTreeImageList = ViewDlg_CreateTreeImageList();
    TreeView_SetImageList(hwndTreeView, s_hTreeImageList, TVSIL_NORMAL);

    ViewTree_LoadAll();
    ViewTree_SortAll();
    ViewTree_InsertAll(hwndTreeView);

    return TRUE;    // set focus
}
开发者ID:Moteesh,项目名称:reactos,代码行数:14,代码来源:view.cpp

示例15: RGB

BOOL FileBrowser::setImageList(int root_clean_id, int root_dirty_id, int open_node_id, int closed_node_id, int leaf_id) 
{
	HBITMAP hbmp;
	COLORREF maskColour = RGB(192, 192, 192);
	const int nbBitmaps = 5;

	// Creation of image list
	if ((_hImaLst = ImageList_Create(CX_BITMAP, CY_BITMAP, ILC_COLOR32 | ILC_MASK, nbBitmaps, 0)) == NULL) 
		return FALSE;

	// Add the bmp in the list
	hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(root_clean_id));
	if (hbmp == NULL)
		return FALSE;
	ImageList_AddMasked(_hImaLst, hbmp, maskColour);
	DeleteObject(hbmp);

	hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(root_dirty_id));
	if (hbmp == NULL)
		return FALSE;
	ImageList_AddMasked(_hImaLst, hbmp, maskColour);
	DeleteObject(hbmp);

	hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(open_node_id));
	if (hbmp == NULL)
		return FALSE;
	ImageList_AddMasked(_hImaLst, hbmp, maskColour);
	DeleteObject(hbmp);

	hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(closed_node_id));
	if (hbmp == NULL)
		return FALSE;
	ImageList_AddMasked(_hImaLst, hbmp, maskColour);
	DeleteObject(hbmp);

	hbmp = LoadBitmap(_hInst, MAKEINTRESOURCE(leaf_id));
	if (hbmp == NULL)
		return FALSE;
	ImageList_AddMasked(_hImaLst, hbmp, maskColour);
	DeleteObject(hbmp);

	if (ImageList_GetImageCount(_hImaLst) < nbBitmaps)
		return FALSE;

	// Set image list to the tree view
	TreeView_SetImageList(_treeView.getHSelf(), _hImaLst, TVSIL_NORMAL);

	return TRUE;
}
开发者ID:fixfelix,项目名称:notepad-plus-plus,代码行数:49,代码来源:fileBrowser.cpp


注:本文中的TreeView_SetImageList函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。