本文整理汇总了C++中ImageList_Create函数的典型用法代码示例。如果您正苦于以下问题:C++ ImageList_Create函数的具体用法?C++ ImageList_Create怎么用?C++ ImageList_Create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ImageList_Create函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToolBarSetImageList
BOOLEAN
ToolBarSetImageList(
IN PTOOLBAR_OBJECT ToolBar,
IN UINT BitmapId,
IN COLORREF Mask
)
{
HBITMAP hBitmap;
BITMAP Bitmap = {0};
LONG Width, Height;
HIMAGELIST himlNormal;
HIMAGELIST himlGray;
hBitmap = LoadBitmap(SdkInstance, MAKEINTRESOURCE(BitmapId));
ASSERT(hBitmap != NULL);
if (hBitmap == NULL) {
return FALSE;
}
if (!GetObject(hBitmap, sizeof(BITMAP), &Bitmap)) {
return FALSE;
}
Width = Bitmap.bmWidth / ToolBar->Count;
Height = Bitmap.bmHeight;
himlNormal = ImageList_Create(Width, Height, ILC_COLOR32 | ILC_MASK, ToolBar->Count, 0);
ASSERT(himlNormal);
if (himlNormal == NULL) {
return FALSE;
}
ImageList_AddMasked(himlNormal, hBitmap, Mask);
SendMessage(ToolBar->hWnd, TB_SETIMAGELIST, 0L, (LPARAM)himlNormal);
SendMessage(ToolBar->hWnd, TB_SETHOTIMAGELIST, 0L, (LPARAM)himlNormal);
DeleteObject(hBitmap);
hBitmap = NULL;
himlGray = SdkCreateGrayImageList(himlNormal);
SendMessage(ToolBar->hWnd, TB_SETDISABLEDIMAGELIST, 0L, (LPARAM)himlGray);
ToolBar->himlNormal = himlNormal;
ToolBar->himlGray = himlGray;
return TRUE;
}
示例2: ListView_SetExtendedListViewStyle
bool VDUIListViewW32::Create(IVDUIParameters *pParameters) {
mbCheckable = pParameters->GetB(nsVDUI::kUIParam_Checkable, false);
DWORD dwFlags = LVS_REPORT | WS_TABSTOP;
if (pParameters->GetB(nsVDUI::kUIParam_NoHeader, false))
dwFlags |= LVS_NOCOLUMNHEADER;
if (!CreateW32(pParameters, WC_LISTVIEW, dwFlags))
return false;
ListView_SetExtendedListViewStyle(mhwnd, LVS_EX_FULLROWSELECT | ListView_GetExtendedListViewStyle(mhwnd));
if (mbCheckable) {
const int cx = GetSystemMetrics(SM_CXMENUCHECK);
const int cy = GetSystemMetrics(SM_CYMENUCHECK);
if (HBITMAP hbm = CreateBitmap(cx, cy, 1, 1, NULL)) {
if (HDC hdc = CreateCompatibleDC(NULL)) {
if (HGDIOBJ hbmOld = SelectObject(hdc, hbm)) {
bool success = false;
RECT r = { 0, 0, cx, cy };
SetBkColor(hdc, PALETTEINDEX(0));
ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &r, "", 0, NULL);
DrawFrameControl(hdc, &r, DFC_BUTTON, DFCS_BUTTONCHECK|DFCS_CHECKED);
SelectObject(hdc, hbmOld);
if (HIMAGELIST himl = ImageList_Create(cx, cy, ILC_COLOR, 1, 1)) {
if (ImageList_Add(himl, hbm, NULL) >= 0)
ListView_SetImageList(mhwnd, himl, LVSIL_STATE);
else
ImageList_Destroy(himl);
}
}
DeleteDC(hdc);
}
DeleteObject(hbm);
}
}
return true;
}
示例3: MakeControlToolBar
int MakeControlToolBar ( int iControlID, int iStyle, int iExtendedStyle, DWORD pFilename, int iNumberOfToolImages )
{
// Assign the style
DWORD dwExtendedStyle = GetExtendedStyle ( iExtendedStyle );
DWORD dwSelectStyle = CCS_TOP;
switch ( iStyle )
{
case 1 : dwSelectStyle |= 0; break;
}
// Create control
MaintainGlobalHWND();
if ( !CreateControl ( iControlID, g_pGlob->hWnd, TOOLBARCLASSNAME, dwExtendedStyle, dwSelectStyle, "", 0, 0, 0, 0 ) )
return 0;
// Create image list
g_pControls [ iControlID ].himlImageList = ImageList_Create(16, 16, ILC_COLOR24, 0, 65535);
// Assign the image lists to the list view control.
HWND hwndTB = g_pControls [ iControlID ].hWnd;
// Sets the size of the TBBUTTON structure.
SendMessage(hwndTB, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
// Set the maximum number of text rows and bitmap size.
SendMessage(hwndTB, TB_SETBITMAPSIZE, 0, (LPARAM)MAKELONG(16, 16));
// Load bitmap for all buttons
for ( int iI=0; iI<iNumberOfToolImages; iI++ )
{
char pFile[256];
wsprintf ( pFile, "%s%d.bmp", pFilename, iI );
HBITMAP hbmp = (HBITMAP)LoadImage(NULL, pFile,IMAGE_BITMAP,16,16,LR_LOADFROMFILE);
ImageList_Add(g_pControls [ iControlID ].himlImageList,hbmp,NULL);
}
SendMessage(hwndTB, TB_SETIMAGELIST, 0, (LPARAM)g_pControls [ iControlID ].himlImageList);
SendMessage(hwndTB, TB_SETHOTIMAGELIST, 0, (LPARAM)g_pControls [ iControlID ].himlImageList);
// Subclass to get access to all control messages directly
g_pControls [ iControlID ].lOriginalWinProc = SetWindowLong ( hwndTB, GWL_WNDPROC, (LONG)SubClassControlWinProc );
// Update safe rects after new addition
UpdateSafeRectsArray();
// Success
return 1;
}
示例4: LoadContactListModule2
int LoadContactListModule2(void)
{
HookEvent(ME_SYSTEM_MODULESLOADED, ContactListModulesLoaded);
HookEvent(ME_PROTO_ACCLISTCHANGED, ContactListAccountsChanged);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
HookEvent(ME_DB_CONTACT_ADDED, ContactAdded);
HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted);
HookEvent(ME_PROTO_ACK, ProtocolAck);
hContactDoubleClicked = CreateHookableEvent(ME_CLIST_DOUBLECLICKED);
hContactIconChangedEvent = CreateHookableEvent(ME_CLIST_CONTACTICONCHANGED);
LoadCluiServices();
CreateServiceFunction(MS_CLIST_CONTACTDOUBLECLICKED, ContactDoubleClicked);
CreateServiceFunction(MS_CLIST_CONTACTFILESDROPPED, ContactFilesDropped);
CreateServiceFunction(MS_CLIST_GETSTATUSMODEDESCRIPTION, GetStatusModeDescription);
CreateServiceFunction(MS_CLIST_GETCONTACTDISPLAYNAME, GetContactDisplayName);
CreateServiceFunction(MS_CLIST_INVALIDATEDISPLAYNAME, InvalidateDisplayName);
CreateServiceFunction(MS_CLIST_CONTACTSCOMPARE, CompareContacts);
CreateServiceFunction(MS_CLIST_CONTACTCHANGEGROUP, ContactChangeGroup);
CreateServiceFunction(MS_CLIST_SHOWHIDE, ShowHideStub);
CreateServiceFunction(MS_CLIST_SETHIDEOFFLINE, SetHideOfflineStub);
CreateServiceFunction(MS_CLIST_DOCKINGPROCESSMESSAGE, Docking_ProcessWindowMessageStub);
CreateServiceFunction(MS_CLIST_DOCKINGISDOCKED, Docking_IsDocked);
CreateServiceFunction(MS_CLIST_HOTKEYSPROCESSMESSAGE, HotkeysProcessMessageStub);
CreateServiceFunction(MS_CLIST_GETCONTACTICON, GetContactIcon);
InitCListEvents();
InitGroupServices();
cli.pfnInitTray();
hCListImages = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 13, 0);
HookEvent(ME_SKIN_ICONSCHANGED, CListIconsChanged);
CreateServiceFunction(MS_CLIST_GETICONSIMAGELIST, GetIconsImageList);
ImageList_AddIcon_NotShared(hCListImages, MAKEINTRESOURCE(IDI_BLANK));
//now all core skin icons are loaded via icon lib. so lets release them
for (int i=0; i < SIZEOF(statusModeList); i++)
ImageList_AddIcon_IconLibLoaded(hCListImages, skinIconStatusList[i]);
//see IMAGE_GROUP... in clist.h if you add more images above here
ImageList_AddIcon_IconLibLoaded(hCListImages, SKINICON_OTHER_GROUPOPEN);
ImageList_AddIcon_IconLibLoaded(hCListImages, SKINICON_OTHER_GROUPSHUT);
return 0;
}
示例5: RebarSetBarImage
BOOLEAN
RebarSetBarImage(
__in HWND hWndBar,
__in COLORREF Mask,
__out HIMAGELIST *Normal,
__out HIMAGELIST *Grayed
)
{
ULONG Number;
HIMAGELIST himlNormal;
HIMAGELIST himlGrayed;
HICON hicon;
REBARINFO Info = {0};
//
// Create imagelist for toolbar band
//
Number = sizeof(CommandBarButtons) / sizeof(TBBUTTON);
himlNormal = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, Number, Number);
hicon = LoadIcon(SdkInstance, MAKEINTRESOURCE(IDI_ICON_DEDUCTION));
ImageList_AddIcon(himlNormal, hicon);
hicon = LoadIcon(SdkInstance, MAKEINTRESOURCE(IDI_ICON_SEARCH));
ImageList_AddIcon(himlNormal, hicon);
SendMessage(hWndBar, TB_SETIMAGELIST, 0, (LPARAM)himlNormal);
SendMessage(hWndBar, TB_SETHOTIMAGELIST, 0, (LPARAM)himlNormal);
himlGrayed = SdkCreateGrayImageList(himlNormal);
SendMessage(hWndBar, TB_SETDISABLEDIMAGELIST, 0, (LPARAM)himlGrayed);
*Normal = himlNormal;
*Grayed = himlGrayed;
//
// Set rebar's imagelist
//
Info.cbSize = sizeof(Info);
Info.fMask = RBIM_IMAGELIST;
Info.himl = himlNormal;
SendMessage(GetParent(hWndBar), RB_SETBARINFO, 0, (LPARAM)&Info);
return TRUE;
}
示例6: SetImageList
static VOID
SetImageList(HWND hwnd)
{
HIMAGELIST hImageList;
hImageList = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR24, 1, 1);
if (!hImageList)
{
MessageBox(hwnd, _T("ImageList it is not created!"), NULL, MB_OK);
return;
}
ImageList_AddMasked(hImageList,
LoadImage(hInstance, MAKEINTRESOURCE(IDB_PLAYICON), IMAGE_BITMAP, 16, 16, LR_DEFAULTCOLOR),
RGB(255, 255, 255));
ImageList_AddMasked(hImageList,
LoadImage(hInstance, MAKEINTRESOURCE(IDB_STOPICON), IMAGE_BITMAP, 16, 16, LR_DEFAULTCOLOR),
RGB(255, 255, 255));
ImageList_AddMasked(hImageList,
LoadImage(hInstance, MAKEINTRESOURCE(IDB_EJECTICON), IMAGE_BITMAP, 16, 16, LR_DEFAULTCOLOR),
RGB(255, 255, 255));
ImageList_AddMasked(hImageList,
LoadImage(hInstance, MAKEINTRESOURCE(IDB_BACKWARDICON), IMAGE_BITMAP, 16, 16, LR_DEFAULTCOLOR),
RGB(255, 255, 255));
ImageList_AddMasked(hImageList,
LoadImage(hInstance, MAKEINTRESOURCE(IDB_SEEKBACKICON), IMAGE_BITMAP, 16, 16, LR_DEFAULTCOLOR),
RGB(255, 255, 255));
ImageList_AddMasked(hImageList,
LoadImage(hInstance, MAKEINTRESOURCE(IDB_SEEKFORWICON), IMAGE_BITMAP, 16, 16, LR_DEFAULTCOLOR),
RGB(255, 255, 255));
ImageList_AddMasked(hImageList,
LoadImage(hInstance, MAKEINTRESOURCE(IDB_FORWARDICON), IMAGE_BITMAP, 16, 16, LR_DEFAULTCOLOR),
RGB(255, 255, 255));
ImageList_Destroy((HIMAGELIST)SendMessage(hToolBar,
TB_SETIMAGELIST,
0,
(LPARAM)hImageList));
}
示例7: ImageList_Destroy
void CMyCombo::SetImages(int nImages, UINT ImageID)
{
if (m_himlImages) {
ImageList_Destroy(m_himlImages);
m_himlImages = NULL;
}
HBITMAP hbm = LoadBitmap(MAKEINTRESOURCE(ImageID));
BITMAP bm = {0};
::GetObject(hbm, sizeof(BITMAP), &bm);
int iImageWidth = bm.bmWidth / nImages;
int iImageHeight = bm.bmHeight;
COLORREF crMask = RGB(255, 0, 255);
m_himlImages = ImageList_Create(iImageWidth, iImageHeight, ILC_COLOR32 | ILC_MASK, nImages, 0);
ImageList_AddMasked(m_himlImages, hbm, crMask);
::DeleteObject(hbm);
}
示例8: ImageList_Create
HIMAGELIST CSkin::LoadImageList(int cx, int cy, LPCTSTR pszFile, UINT uDef)
{
#ifdef _WIN32_WCE
UINT uFlags = ILC_COLOR|ILC_MASK;
#else
UINT uFlags = ILC_COLOR24|ILC_MASK;
#endif
HIMAGELIST himl = ImageList_Create(cx, cy, uFlags, 0, 0);
if (!himl)
return NULL;
HBITMAP hbmp = LoadBitmap(pszFile);
if (!hbmp)
hbmp = ::LoadBitmap(GetInst(), (LPCTSTR)uDef);
ImageList_AddMasked(himl, hbmp, MASK_COLOR);
DeleteObject(hbmp);
return himl;
}
示例9: ImageList_Create
HIMAGELIST MyTreeView::setImageList( HBITMAP defIcon ){
//if ( !defImage ) return 0;
this->imgList = ImageList_Create(MYTREEVIEW_DEFAULT_ICONSIZE,MYTREEVIEW_DEFAULT_ICONSIZE,ILC_COLOR24,0,0);
if ( defIcon && imgList )
{
defIconIdx = ImageList_Add(this->imgList, defIcon, NULL);
}
SendMessage(this->getHWND(),TVM_SETIMAGELIST,TVSIL_NORMAL,(LPARAM)this->imgList);
/*HBITMAP image = (HBITMAP)LoadImage(this->hInstance, defImage, IMAGE_BITMAP, MYTREEVIEW_DEFAULT_ICONSIZE, MYTREEVIEW_DEFAULT_ICONSIZE,
LR_DEFAULTSIZE | LR_LOADFROMFILE );
if ( image ){
ImageList_Add(this->imgList,image,NULL);
}*/
return 0;
}
示例10: UpdateLayoutsList
VOID
UpdateLayoutsList(VOID)
{
HIMAGELIST hImgList;
/* Clear the list */
(VOID) ListView_DeleteAllItems(GetDlgItem(MainDlgWnd, IDC_KEYLAYOUT_LIST));
/* Crate new list */
hImgList = ImageList_Create(16, 16, ILC_COLOR8 | ILC_MASK, 0, 1);
InitLangList(MainDlgWnd, hImgList);
hImgList = ListView_SetImageList(GetDlgItem(MainDlgWnd, IDC_KEYLAYOUT_LIST), hImgList, LVSIL_SMALL);
/* Destroy old image list */
if(hImgList)
(VOID) ImageList_Destroy(hImgList);
}
示例11: GetSystemMetrics
HIMAGELIST CheckedListView::CreateCheckBoxImageList(HWND hWnd)
{
HDC hdc_wnd, hdc;
HBITMAP hbm_im, hbm_mask, hbm_orig;
RECT rc;
HIMAGELIST himl;
int x = GetSystemMetrics(SM_CXSMICON);
himl = ImageList_Create(x, GetSystemMetrics(SM_CYSMICON), ILC_COLOR16 | ILC_MASK, 2, 2);
hdc_wnd = GetDC(hWnd);
hdc = CreateCompatibleDC(hdc_wnd);
hbm_im = CreateCompatibleBitmap(hdc_wnd, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON));
hbm_mask = CreateBitmap(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 1, 1, NULL);
ReleaseDC(hWnd, hdc_wnd);
rc.left = rc.top = 0;
rc.right = GetSystemMetrics(SM_CXSMICON);
rc.bottom = GetSystemMetrics(SM_CYSMICON);
hbm_orig = (HBITMAP) SelectObject(hdc, hbm_mask);
SelectObject(hdc, hbm_im);
// Create normal image
_createButtonCheckImage(hdc, &rc, false, CheckedColorNone);
SelectObject(hdc, hbm_orig);
ImageList_Add(himl, hbm_im, hbm_mask);
SelectObject(hdc, hbm_im);
// Create color checked images
CheckedColor colors[] = {CheckedColorBlack, CheckedColorGrey, CheckedColorYellow, CheckedColorGreen, CheckedColorNone};
CheckedColor* color = colors;
while (*color != CheckedColorNone)
{
_createButtonCheckImage(hdc, &rc, true, *color);
SelectObject(hdc, hbm_orig);
ImageList_Add(himl, hbm_im, hbm_mask);
SelectObject(hdc, hbm_im);
color++;
}
DeleteObject(hbm_mask);
DeleteObject(hbm_im);
DeleteDC(hdc);
return himl;
}
示例12: BuildTree
static int BuildTree(HWND hwndDlg)
{
HWND hTree = GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE);
OrderData *dat = (OrderData*)GetWindowLongPtr(hTree, GWLP_USERDATA);
dat->himlButtonIcons = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 2, 2);
TreeView_SetImageList(hTree, dat->himlButtonIcons, TVSIL_NORMAL);
SetWindowLongPtr(hTree, GWL_STYLE, GetWindowLongPtr(hTree,GWL_STYLE)|TVS_NOHSCROLL);
TreeView_DeleteAllItems(hTree);
if (Buttons.getCount() == 0)
return FALSE;
for (int i = 0; i < Buttons.getCount(); i++)
AddLine(hTree, Buttons[i], TVI_LAST, dat->himlButtonIcons);
return TRUE;
}
示例13: MIR_APP_DLL
MIR_APP_DLL(int) Menu_AddObject(LPCSTR szName, LPCSTR szDisplayName, LPCSTR szCheckService, LPCSTR szExecService)
{
if (szName == NULL || szDisplayName == NULL)
return NULL;
mir_cslock lck(csMenuHook);
TIntMenuObject *p = new TIntMenuObject();
p->id = NextObjectId++;
p->pszName = mir_strdup(szName);
p->ptszDisplayName = mir_a2t(szDisplayName);
p->CheckService = mir_strdup(szCheckService);
p->ExecService = mir_strdup(szExecService);
p->m_hMenuIcons = ImageList_Create(g_iIconSX, g_iIconSY, ILC_COLOR32 | ILC_MASK, 15, 100);
g_menus.insert(p);
return p->id;
}
示例14: LoadModuleIcons
void LoadModuleIcons(MODULEINFO *mi)
{
HIMAGELIST hList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0);
int overlayIcon = ImageList_AddIcon(hList, GetCachedIcon("chat_overlay"));
ImageList_SetOverlayImage(hList, overlayIcon, 1);
int index = ImageList_AddIcon(hList, Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_ONLINE));
mi->hOnlineIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT);
mi->hOnlineTalkIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
index = ImageList_AddIcon(hList, Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_OFFLINE));
mi->hOfflineIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT);
mi->hOfflineTalkIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
ImageList_Destroy(hList);
}
示例15: str
void CFolderDlg::OnInitDialog(HWND hDlg)
{
CTempStr str(IDS_ROOT_FOLDER_NAME);
ShellInitDialog(hDlg);
HWND hTreeView = GetDlgItem(hDlg, IDC_TREE_FOLDER);
m_bRefresh = FALSE;
m_hImageList = NULL;
HICON hIcon;
//イメージリスト作成
m_hImageList = ImageList_Create(SCALEX(16), SCALEY(16), ILC_COLOR|ILC_MASK, 1, 2);
hIcon = (HICON)LoadImage(GetInst(), (LPCTSTR)IDI_ROOT, IMAGE_ICON, SCALEX(16), SCALEY(16), 0);
ImageList_AddIcon(m_hImageList, hIcon);
DeleteObject(hIcon);
SHFILEINFO shfi;
SHGetFileInfo(_T("\\Windows"), NULL, &shfi, sizeof(shfi), SHGFI_SMALLICON | SHGFI_ICON);
ImageList_AddIcon(m_hImageList, shfi.hIcon);
TreeView_SetImageList(hTreeView, m_hImageList, TVSIL_NORMAL);
SetWindowLong(hTreeView, GWL_STYLE, GetWindowLong(hTreeView, GWL_STYLE)|TVS_HASBUTTONS|TVS_HASLINES|TVS_SHOWSELALWAYS);
//フォルダ読み込み
HCURSOR hCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
TVINSERTSTRUCT tvis;
tvis.hParent = NULL;
tvis.hInsertAfter = TVI_SORT;
tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN;
tvis.item.pszText = str;
tvis.item.iImage = 0;
tvis.item.iSelectedImage = 0;
tvis.item.cChildren = 1;
HTREEITEM hRoot = TreeView_InsertItem(hTreeView, &tvis);
TreeView_Expand(hTreeView, hRoot, TVE_EXPAND);
//カレントフォルダをセット
SetCurrentFolder(hTreeView, m_pszPath);
if (m_bSubFolder)
SendMessage(GetDlgItem(hDlg, IDC_CHECK_SUBFOLDER), BM_SETCHECK, 1, 0);
SetCursor(hCursor);
}