本文整理汇总了C++中ImageList_Add函数的典型用法代码示例。如果您正苦于以下问题:C++ ImageList_Add函数的具体用法?C++ ImageList_Add怎么用?C++ ImageList_Add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ImageList_Add函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ImageList_Create
void MainWindow::W7ToolbarSetImages() {
QPixmap img;
QBitmap mask;
HIMAGELIST himl = ImageList_Create(20, 20, ILC_COLOR32, 4, 0);
img = QIcon(":/back.png").pixmap(20);
mask = img.createMaskFromColor(Qt::transparent);
ImageList_Add(himl, img.toWinHBITMAP(QPixmap::PremultipliedAlpha), mask.toWinHBITMAP());
img = QIcon(":/play.png").pixmap(20);
mask = img.createMaskFromColor(Qt::transparent);
ImageList_Add(himl, img.toWinHBITMAP(QPixmap::PremultipliedAlpha), mask.toWinHBITMAP());
img = QIcon(":/forward.png").pixmap(20);
mask = img.createMaskFromColor(Qt::transparent);
ImageList_Add(himl, img.toWinHBITMAP(QPixmap::PremultipliedAlpha), mask.toWinHBITMAP());
img = QIcon(":/pause.png").pixmap(20);
mask = img.createMaskFromColor(Qt::transparent);
ImageList_Add(himl, img.toWinHBITMAP(QPixmap::PremultipliedAlpha), mask.toWinHBITMAP());
if (m_w7toolbar) m_w7toolbar->ThumbBarSetImageList(this->winId(), himl);
ImageList_Destroy(himl);
}
示例2: ImageList_Add
void InsertObjectDialog::LoadObjects()
{
// Create imagelists
m_LargeImages.Create(32, 32, ILC_COLOR24, 0, 10);
small_images.Create(16, 16, ILC_COLOR24, 0, 10);
map<int, CPlugin>::iterator i = g_Plugins.begin();
for ( ; i != g_Plugins.end(); i++)
{
CString lowerName = i->second.m_Name;
lowerName.MakeLower();
if (!i->second.m_bMovement && lowerName != "tag")
{
bool bGame = false;
if (application.runtime != CApplication::rt_application) bGame = true;
if (!bGame && i->second.m_Category == OT_GAME)
continue;
// Extract the icon
ImageList_Add(m_LargeImages, i->second.m_LargeIcon, NULL);
ImageList_Add(small_images, i->second.m_SmallIcon, NULL);
}
}
}
示例3: 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;
}
示例4: ImageList_Destroy
// Create a drag image from a bitmap and optional cursor
bool wxDragImage::Create(const wxBitmap& image, const wxCursor& cursor)
{
if ( m_hImageList )
ImageList_Destroy(GetHimageList());
m_hImageList = 0;
#ifdef __WXWINCE__
UINT flags = ILC_COLOR;
#else
UINT flags wxDUMMY_INITIALIZE(0) ;
if (image.GetDepth() <= 4)
flags = ILC_COLOR4;
else if (image.GetDepth() <= 8)
flags = ILC_COLOR8;
else if (image.GetDepth() <= 16)
flags = ILC_COLOR16;
else if (image.GetDepth() <= 24)
flags = ILC_COLOR24;
else
flags = ILC_COLOR32;
#endif
bool mask = (image.GetMask() != 0);
// Curiously, even if the image doesn't have a mask,
// we still have to use ILC_MASK or the image won't show
// up when dragged.
// if ( mask )
flags |= ILC_MASK;
m_hImageList = (WXHIMAGELIST) ImageList_Create(image.GetWidth(), image.GetHeight(), flags, 1, 1);
int index;
if (!mask)
{
HBITMAP hBitmap1 = (HBITMAP) image.GetHBITMAP();
index = ImageList_Add(GetHimageList(), hBitmap1, 0);
}
else
{
HBITMAP hBitmap1 = (HBITMAP) image.GetHBITMAP();
HBITMAP hBitmap2 = (HBITMAP) image.GetMask()->GetMaskBitmap();
HBITMAP hbmpMask = wxInvertMask(hBitmap2);
index = ImageList_Add(GetHimageList(), hBitmap1, hbmpMask);
::DeleteObject(hbmpMask);
}
if ( index == -1 )
{
wxLogError(_("Couldn't add an image to the image list."));
}
m_cursor = cursor; // Can only combine with drag image after calling BeginDrag.
return (index != -1) ;
}
示例5: _ui_init
BOOL _ui_init(
HINSTANCE h_inst
)
{
HBITMAP undisk = LoadBitmap( h_inst, MAKEINTRESOURCE( IDB_UNDISK ) );
HBITMAP undisk_mask = LoadBitmap( h_inst, MAKEINTRESOURCE( IDB_UNDISK_MASK ) );
HBITMAP disk = LoadBitmap( h_inst, MAKEINTRESOURCE( IDB_DISK ) );
HBITMAP disk_mask = LoadBitmap( h_inst, MAKEINTRESOURCE( IDB_DISK_MASK ) );
HBITMAP cdrom = LoadBitmap( h_inst, MAKEINTRESOURCE( IDB_CDROM ) );
HBITMAP cdrom_mask = LoadBitmap( h_inst, MAKEINTRESOURCE( IDB_CDROM_MASK ) );
HBITMAP disk_enb = LoadBitmap( h_inst, MAKEINTRESOURCE( IDB_ENABLED ) );
HBITMAP check = LoadBitmap( h_inst, MAKEINTRESOURCE( IDB_CHECK ) );
HBITMAP check_mask = LoadBitmap( h_inst, MAKEINTRESOURCE( IDB_CHECK_MASK ) );
NONCLIENTMETRICS metric = { sizeof(metric) };
InitCommonControls( );
if ( LoadLibrary(L"riched20.dll") == 0 ) return FALSE;
__hinst = h_inst;
__dlg = HWND_DESKTOP;
metric.lfMessageFont.lfWeight = FW_BOLD;
metric.lfMessageFont.lfHeight = -11;
__font_bold = CreateFontIndirect( &metric.lfMessageFont );
metric.lfMessageFont.lfWeight = FW_DONTCARE;
metric.lfMessageFont.lfUnderline = TRUE;
__font_link = CreateFontIndirect( &metric.lfMessageFont );
metric.lfMessageFont.lfHeight = -9;
metric.lfMessageFont.lfUnderline = FALSE;
__font_small = CreateFontIndirect( &metric.lfMessageFont );
__img = ImageList_Create( 9, 9, ILC_MASK, 2, 2 );
__dsk_img = ImageList_Create( 15, 11, ILC_MASK | ILC_COLOR24, 5, 5 );
ImageList_Add( __img, check, check_mask );
ImageList_Add( __dsk_img, disk, disk_mask );
ImageList_Add( __dsk_img, undisk, undisk_mask );
ImageList_Add( __dsk_img, disk_enb, disk_mask );
ImageList_Add( __dsk_img, cdrom, cdrom_mask );
__cur_arrow = LoadCursor( NULL, IDC_ARROW );
__cur_hand = LoadCursor( NULL, IDC_HAND );
__cur_wait = LoadCursor( NULL, IDC_WAIT );
return TRUE;
}
示例6: ImageList_Destroy
void pListView::setImageList() {
auto &list = listView.state.image;
if(imageList) {
ImageList_Destroy(imageList);
imageList = nullptr;
}
bool found = false;
for(auto &row : listView.state.image) {
for(auto &column : row) {
if(column.empty() == false) {
found = true;
break;
}
}
}
if(found == false) return;
imageList = ImageList_Create(15, 15, ILC_COLOR32, 1, 0);
nall::image image;
image.allocate(15, 15);
image.clear(GetSysColor(COLOR_WINDOW));
ImageList_Add(imageList, CreateBitmap(image), NULL);
for(unsigned row = 0; row < list.size(); row++) {
for(unsigned column = 0; column < list(row).size(); column++) {
nall::image image = list(row)(column);
if(image.empty()) continue;
image.transform(0, 32, 255u << 24, 255u << 16, 255u << 8, 255u << 0);
image.scale(15, 15, Interpolation::Linear);
ImageList_Add(imageList, CreateBitmap(image), NULL);
}
}
ListView_SetImageList(hwnd, imageList, LVSIL_SMALL);
unsigned ID = 1;
for(unsigned row = 0; row < list.size(); row++) {
for(unsigned column = 0; column < list(row).size(); column++) {
if(list(row)(column).empty()) continue; //I_IMAGENONE does not work properly
LVITEM item;
item.mask = LVIF_IMAGE;
item.iItem = row;
item.iSubItem = column;
item.iImage = ID++;
ListView_SetItem(hwnd, &item);
}
}
}
示例7: images
MapData::MapData(char const* path)
: images(DictionaryMap::alNumNoCase)
{
imgList = NULL;
map = MPQArchive::open(path, File::READ);
if (map == NULL)
map = MPQArchive::open(String::buildFullName(cfg.warPath, path), File::READ);
if (map)
{
imgList = ImageList_Create(16, 16, ILC_COLOR24, 16, 16);
MPQLoader loader(*getApp()->getWarLoader());
loader.addArchive(map);
LoadGameData(data, &loader, WC3_LOAD_UNITS | WC3_LOAD_ITEMS |
WC3_LOAD_ABILITIES | WC3_LOAD_UPGRADES | WC3_LOAD_MERGED | WC3_LOAD_NO_WEONLY);
Image blank(16, 16);
blank.fill(Image::clr(255, 255, 255));
HBITMAP hBitmap = blank.createBitmap();
ImageList_Add(imgList, hBitmap, NULL);
DeleteObject(hBitmap);
images.set("", 0);
}
}
示例8: ImageList_Add
void AnimatorBar::UpdateFilmStrip()
{
film_strip.SetRedraw(false);
m_ImageList.DeleteImageList();
film_strip.DeleteAllItems();
if(!m_pCurrentAnimation)
return;
m_ImageList.Create(32, 32, ILC_COLOR24, 3, 3);
film_strip.SetImageList(&m_ImageList, LVSIL_NORMAL);
for (int i = 0; i < m_pCurrentAnimation->m_Images.size(); i++)
{
// Create thumbnail & add to filmstrip
CImageResource* pImage = application->resources.FindImageResourceFromNumber(m_pCurrentAnimation->m_Images[i]);
if(pImage)
{
HBITMAP Bitmap = pImage->GetHBitmap(true,false);
ImageList_Add(m_ImageList.m_hImageList, Bitmap, Bitmap);
CString Name;
Name.Format("%d", i + 1);
film_strip.InsertItem(i, Name, i);
}
}
film_strip.SetRedraw(true);
film_strip.Invalidate();
}
示例9: GetISpinner
void RendSplineParamsMapDlgProc::Initialize(HWND hWnd, TimeValue t)
{
if (hWnd == NULL) return;
else
{
ISpinnerControl *iSpin = GetISpinner(GetDlgItem(hWnd, IDC_ASPECTSPIN));
iSpin->LinkToEdit(GetDlgItem(hWnd, IDC_ASPECT), EDITTYPE_FLOAT);
iSpin->SetLimits(0.0f,99999999.0f);
iSpin->SetAutoScale(TRUE);
ReleaseISpinner(iSpin);
if (RendSpline::hLockButton == NULL) {
HBITMAP hBitmap, hMask;
RendSpline::hLockButton = ImageList_Create(16, 15, TRUE, 2, 0);
hBitmap = LoadBitmap(RendSplineDesc.HInstance(), MAKEINTRESOURCE(IDB_LOCK));
hMask = LoadBitmap(RendSplineDesc.HInstance(), MAKEINTRESOURCE(IDB_LOCKMASK));
ImageList_Add(RendSpline::hLockButton,hBitmap,hMask);
DeleteObject(hBitmap);
DeleteObject(hMask);
}
ICustButton *lockAspect = GetICustButton(GetDlgItem(hWnd,IDC_ASPECTLOCK));
lockAspect->SetImage(RendSpline::hLockButton,0,0,1,1,16,15);
lockAspect->SetType(CBT_CHECK);
ReleaseICustButton(lockAspect);
CheckRadioButton(hWnd, IDC_VIEWPORT, IDC_RENDERER, IDC_RENDERER);
BOOL usePhysUVs = mod->GetUsePhysicalScaleUVs();
CheckDlgButton(hWnd, IDC_REAL_WORLD_MAP_SIZE, usePhysUVs);
}
}
示例10: InitIML
void InitIML() {
int i;
HIMAGELIST hImageList = ImageList_Create(16, 16, ILC_COLOR32, 3, 0);
HBITMAP hbIcons = (HBITMAP)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BITMAP1), IMAGE_BITMAP, 48, 16, LR_DEFAULTCOLOR);
ImageList_Add(hImageList, hbIcons, NULL);
for (i = 0; i != 3; i++)
stateicons[i] = ImageList_GetIcon(hImageList, i, ILD_NORMAL);
SendMessage(hWnd_Tab, TCM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)hImageList);
hCfgTabiml = ImageList_Create(16, 16, ILC_COLOR32, 6, 0);
hbIcons = (HBITMAP)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BITMAP3), IMAGE_BITMAP, 96, 16, LR_DEFAULTCOLOR);
ImageList_AddMasked(hCfgTabiml, hbIcons, 0);
/////listview images
hImageList = ImageList_Create(28, 14, ILC_COLOR32 | ILC_MASK, 32, 0);
ImageList_SetBkColor(hImageList, CLR_NONE);
lvwIML = hImageList;
hbIcons = (HBITMAP)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BITMAP2), IMAGE_BITMAP, 896, 14, /*ILC_MASK |*/ LR_DEFAULTCOLOR);
//ImageList_Remove(hImageList, -1);
//char asdf[32];
//sprintf(asdf, "%d", CLR_INVALID == -1);
//MessageBox(0,asdf,0,0);
ImageList_AddMasked(hImageList, hbIcons, 0);
for (i = 0; i != NUM_BNICONS; i++)
bnicons[i] = ImageList_GetIcon(hImageList, i, ILD_NORMAL);
}
示例11: CreateBitmap
void pButton::setImage(const image& image, Orientation orientation) {
nall::image nallImage = image;
nallImage.transform(0, 32, 255u << 24, 255u << 16, 255u << 8, 255u << 0);
if(hbitmap) { DeleteObject(hbitmap); hbitmap = 0; }
if(himagelist) { ImageList_Destroy(himagelist); himagelist = 0; }
if(OsVersion() >= WindowsVista) {
hbitmap = CreateBitmap(nallImage);
SendMessage(hwnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbitmap);
switch(orientation) {
case Orientation::Horizontal: SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~BS_TOP); break;
case Orientation::Vertical: SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | BS_TOP); break;
}
} else {
//Windows XP and earlier cannot display bitmaps and text at the same time with BM_SETIMAGE
//Use BCM_SETIMAGELIST instead. It does not support alpha blending, so blend with button color
//The XP theme and above use a gradient fade background, so it won't be a perfect match there
nallImage.alphaBlend(GetSysColor(COLOR_BTNFACE));
hbitmap = CreateBitmap(nallImage);
himagelist = ImageList_Create(nallImage.width, nallImage.height, ILC_COLOR32, 1, 0);
ImageList_Add(himagelist, hbitmap, NULL);
BUTTON_IMAGELIST list;
list.himl = himagelist;
switch(orientation) {
case Orientation::Horizontal: SetRect(&list.margin, 5, 0, 0, 0); list.uAlign = BUTTON_IMAGELIST_ALIGN_LEFT; break;
case Orientation::Vertical: SetRect(&list.margin, 0, 5, 0, 0); list.uAlign = BUTTON_IMAGELIST_ALIGN_TOP; break;
}
Button_SetImageList(hwnd, &list);
}
setText(button.state.text); //update text to display nicely with image (or lack thereof)
}
示例12: ImageList_GetIconSize
int Icon::add_to_imagelist(HIMAGELIST himl, HDC hdc_wnd, COLORREF bk_color, HBRUSH bk_brush) const
{
int ret;
if (_itype == IT_SYSCACHE) {
HIMAGELIST himl = g_Globals._icon_cache.get_sys_imagelist();
int cx, cy;
ImageList_GetIconSize(himl, &cx, &cy);
HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
HDC hdc = CreateCompatibleDC(hdc_wnd);
HBITMAP hbmp_old = SelectBitmap(hdc, hbmp);
ImageList_DrawEx(himl, _sys_idx, hdc, 0, 0, cx, cy, bk_color, CLR_DEFAULT, ILD_NORMAL);
SelectBitmap(hdc, hbmp_old);
DeleteDC(hdc);
ret = ImageList_Add(himl, hbmp, 0);
DeleteObject(hbmp);
} else
ret = ImageList_AddAlphaIcon(himl, _hicon, bk_brush, hdc_wnd);
return ret;
}
示例13: CreateToolbar
HWND Explorerplusplus::CreateTabToolbar(HWND hParent,int idCommand,TCHAR *szTip)
{
HWND TabToolbar = CreateToolbar(hParent,WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|
TBSTYLE_TOOLTIPS|TBSTYLE_LIST|TBSTYLE_TRANSPARENT|TBSTYLE_FLAT|CCS_NODIVIDER|
CCS_NOPARENTALIGN|CCS_NORESIZE,TBSTYLE_EX_MIXEDBUTTONS|TBSTYLE_EX_DOUBLEBUFFER);
SendMessage(TabToolbar,TB_SETBITMAPSIZE,0,MAKELONG(7,7));
SendMessage(TabToolbar,TB_BUTTONSTRUCTSIZE,sizeof(TBBUTTON),0);
SendMessage(TabToolbar,TB_SETBUTTONSIZE,0,MAKELPARAM(16,16));
/* TODO: The image list is been leaked. */
HIMAGELIST himl = ImageList_Create(7,7,ILC_COLOR32|ILC_MASK,0,2);
HBITMAP hb = LoadBitmap(GetModuleHandle(0),MAKEINTRESOURCE(IDB_TABTOOLBAR_CLOSE));
int iIndex = ImageList_Add(himl,hb,NULL);
SendMessage(TabToolbar,TB_SETIMAGELIST,0,reinterpret_cast<LPARAM>(himl));
DeleteObject(hb);
/* Add the close button, used to close tabs. */
TBBUTTON tbButton;
tbButton.iBitmap = iIndex;
tbButton.idCommand = idCommand;
tbButton.fsState = TBSTATE_ENABLED;
tbButton.fsStyle = TBSTYLE_BUTTON|TBSTYLE_AUTOSIZE;
tbButton.dwData = 0;
tbButton.iString = reinterpret_cast<INT_PTR>(szTip);
SendMessage(TabToolbar,TB_INSERTBUTTON,0,reinterpret_cast<LPARAM>(&tbButton));
SendMessage(TabToolbar,TB_AUTOSIZE,0,0);
return TabToolbar;
}
示例14: LoadBitmap
// CRotateDlg message handlers
BOOL CRotateDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_AngleIcons.Create(16, 16, ILC_COLOR24 | ILC_MASK, 3, 3);
HBITMAP icon = LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_ANGLEICONS));
ImageList_Add(m_AngleIcons, icon, NULL);
DeleteObject(icon);
m_Angle.SetImageList(&m_AngleIcons);
m_Angle.SetWindowText("0");
for (int i = 0; i < 8; i++)
{
COMBOBOXEXITEM insItem;
insItem.mask = CBEIF_IMAGE | CBEIF_TEXT | CBEIF_SELECTEDIMAGE;
insItem.iItem = i;
insItem.iImage = i;
insItem.iSelectedImage = i;
CString Text;
Text.Format("%d", i * 45);
insItem.pszText = Text.GetBuffer(0);
m_Angle.InsertItem(&insItem);
}
m_Angle.SetFocus();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例15: LoadBitmapW
bool
CRootNode::SetupNode()
{
// Load the bitmap we'll be using as the root image
HBITMAP hRootImage;
hRootImage = LoadBitmapW(g_hThisInstance,
MAKEINTRESOURCEW(IDB_ROOT_IMAGE));
if (hRootImage == NULL) return FALSE;
// Add this bitmap to the device image list. This is a bit hacky, but it's safe
m_ClassImage = ImageList_Add(m_ImageListData->ImageList,
hRootImage,
NULL);
DeleteObject(hRootImage);
// Get the root instance
CONFIGRET cr;
cr = CM_Locate_DevNodeW(&m_DevInst,
NULL,
CM_LOCATE_DEVNODE_NORMAL);
if (cr != CR_SUCCESS)
{
return false;
}
// The root name is the computer name
DWORD Size = DISPLAY_NAME_LEN;
GetComputerNameW(m_DisplayName, &Size);
return true;
}