本文整理汇总了C++中CImageList::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ CImageList::Add方法的具体用法?C++ CImageList::Add怎么用?C++ CImageList::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CImageList
的用法示例。
在下文中一共展示了CImageList::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetAllIcons
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));
}
示例2: Py_BuildValue
// @pymethod int|PyCImageList|Add|Adds an image to the list.
PyObject *PyCImageList_Add( PyObject *self, PyObject *args )
{
PyObject *obbmp1, *obbmp2;
int mask;
CImageList *pList = PyCImageList::GetImageList(self);
int rc;
if (!pList)
return NULL;
if (PyArg_ParseTuple(args, "(OO)",
&obbmp1, &obbmp2)) {// @pyparm (int,int)|bitmap, bitmapMask||2 Bitmaps to use (primary and mask)
HBITMAP bmp1, bmp2;
if (!PyWinObject_AsHANDLE(obbmp1, (HANDLE *)&bmp1) || !PyWinObject_AsHANDLE(obbmp2, (HANDLE *)&bmp2))
return NULL;
if (!IsGdiHandleValid(bmp1) || !IsGdiHandleValid(bmp2))
RETURN_ERR("One of the bitmap handles is invalid");
GUI_BGN_SAVE;
rc = pList->Add(CBitmap::FromHandle(bmp1), CBitmap::FromHandle(bmp2));
GUI_END_SAVE;
} else {
PyErr_Clear();
HBITMAP bmp1;
if (PyArg_ParseTuple(args, "Oi",
&obbmp1, // @pyparmalt1 int|bitmap||Bitmap to use
&mask)) { // @pyparmalt1 int|color||Color to use for the mask.
if (!PyWinObject_AsHANDLE(obbmp1, (HANDLE *)&bmp1))
return NULL;
if (!IsGdiHandleValid(bmp1))
RETURN_ERR("The bitmap handle is invalid");
GUI_BGN_SAVE;
rc = pList->Add(CBitmap::FromHandle(bmp1), (COLORREF)mask);
GUI_END_SAVE;
} else {
PyErr_Clear();
PyObject *obIcon;
if (PyArg_ParseTuple(args, "O",
&obIcon)) {// @pyparmalt2 int|hIcon||Handle of an icon to add.
HICON hIcon;
if (!PyWinObject_AsHANDLE(obIcon, (HANDLE *)&hIcon))
return NULL;
GUI_BGN_SAVE;
rc = pList->Add(hIcon);
GUI_END_SAVE;
} else {
PyErr_Clear();
RETURN_ERR("Add requires '(hbitmap, hbitmap)', 'hbitmap, color' or 'hicon'");
}
}
}
if (rc==-1)
RETURN_ERR("Add failed");
return Py_BuildValue("i", rc);
// @rdesc Zero-based index of the first new image.
}
示例3: SetAllIcons
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));
}
示例4: SetAllIcons
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);
}
示例5: SetAllIcons
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();
}
示例6: SetAllIcons
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);
}
示例7: OnInitDialog
BOOL CMediaBrowserPPCDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CenterWindow(GetDesktopWindow()); // center to the hpc screen
// Extra initialization here
CCeCommandBar *pCommandBar = (CCeCommandBar*)m_pWndEmptyCB;
pCommandBar->InsertMenuBar(IDR_MAINMENU);
CImageList* MediaImageList = new CImageList();
MediaImageList->Create(16,16,0,8,8);
CBitmap b1;
b1.LoadBitmap(IDB_DEVICE2BITMAP);
MediaImageList->Add(&b1,RGB(0,0,0));
b1.DeleteObject();
b1.LoadBitmap(IDB_FOLDER1BITMAP);
MediaImageList->Add(&b1,RGB(0,0,0));
b1.DeleteObject();
b1.LoadBitmap(IDB_FOLDER1BITMAP);
MediaImageList->Add(&b1,RGB(0,0,0));
b1.DeleteObject();
b1.LoadBitmap(IDB_METHODBITMAP);
MediaImageList->Add(&b1,RGB(0,0,0));
b1.DeleteObject();
m_MediaList.SetImageList(MediaImageList,LVSIL_SMALL);
memset(devices,0,sizeof(void*)*32);
this->m_MediaList.InsertItem(0,TEXT("Searching..."),-1);
this->m_MediaCombo.AddString(TEXT("Servers"));
this->m_MediaCombo.SetCurSel(0);
MainDialog = this;
CreateThread(NULL,0,&MediaControlPointStart,NULL,0,NULL);
return TRUE; // return TRUE unless you set the focus to a control
}
示例8: InitializeProgressImages
void ProgressImages::InitializeProgressImages(CImageList& img, RgbPixel32 background, RgbPixel32 filled, RgbPixel32 unfilled)
{
m_background = background;
m_unfilled = unfilled;
m_filled = filled;
m_diameter = 14;
m_radius = 7;
m_pieBlurringSize = 2;
m_perimeter = static_cast<int>(GetPI() * m_diameter);
m_background = background;
m_images.clear();
m_images.reserve(m_perimeter+1);
// add 1 for complete coverage, to be on the safe side.
m_angles.Resize(m_radius + 1, static_cast<float>(m_perimeter), 0);// the values returned from m_angles will be in the range 0-perimeter, or in other words, 0-m_images.size().
for(m_i = 0; m_i < m_perimeter; m_i ++)
{
m_bmp = new AnimBitmap<32>();
m_bmp->SetSize(16, 16);
m_bmp->Fill(m_background);
FilledCircleAAG(8, 8, m_radius, this, &ProgressImages::DrawHLine, this, &ProgressImages::DrawAlphaPixel);
// add it to the imagelist.
HBITMAP hbm = m_bmp->DetachHandle();
m_images.push_back(img.Add(hbm));
DeleteObject(hbm);
delete m_bmp;
m_bmp = 0;
}
}
示例9: Create
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;
}
示例10: InitializeDefaultPanes
void CMainFrame::InitializeDefaultPanes(void)
{
CRect rcClient;
this->GetClientRect(&rcClient);
CRect rcFloat(0,0,400,200);
CRect rcDock(0,0,220,/*rcClient.Width()-200*/200);
CRect rcFileTreeDock(0,0,220,10);
CRect rcItemListDock(0,0,150,300);
CRect rcvgmfileDock(0,0,220,/*rcClient.Width()-200*/300);
CRect rcCollListDock(150,150,220,/*rcClient.Width()-200*/100);
CRect rcLogListDock(0,0,400,80);
//CRect rcDock();
CImageList ilIcons;
ilIcons.Create(16, 16, ILC_MASK | ILC_COLOR24, 0, 0);
CBitmap bmpIcons;
bmpIcons.LoadBitmap(IDB_TAB_ICONS);
ilIcons.Add((HBITMAP)bmpIcons, RGB(0,255,0));
HWND hWndFirst =
//CreateVGMFilesTreeViewPane(VGMFilesView, _T("Detected VGM Files"), ilIcons.ExtractIcon(10), rcFloat, rcvgmfileDock, NULL);
CreateVGMFileListViewPane(theVGMFileListView, _T("Detected Music Files"), ilIcons.ExtractIcon(10), rcFloat, rcvgmfileDock, NULL);
CreateFileListViewPane(rawFileListView, _T("Scanned Files"), ilIcons.ExtractIcon(6), rcFloat, rcFileTreeDock, NULL);
CreateVGMCollListViewPane(theVGMCollListView, _T("Collections"), ilIcons.ExtractIcon(10), rcFloat, rcCollListDock, NULL);
//this->CreatePlainTextOutputPane(m_OutputView, _T("Output"), ilIcons.ExtractIcon(3), rcFloat, rcDock, hWndFirst);
//this->CreatePlainTextOutputPane(m_FindResultsView, _T("Find Results 1"), ilIcons.ExtractIcon(11), rcFloat, rcDock, hWndFirst);
CreateCollDialogPane(theCollDialog, _T("Coll Info"), rcFloat, rcDock, NULL);
CreateLogListViewPane(theLogListView, _T("Logs"), ilIcons.ExtractIcon(10), rcFloat, rcLogListDock, NULL);
}
示例11: SetIconsList
//***************************************************************************************
BOOL CBCGPropertySheet::SetIconsList (UINT uiImageListResID, int cx,
COLORREF clrTransparent)
{
ASSERT_VALID(this);
LPCTSTR lpszResourceName = MAKEINTRESOURCE (uiImageListResID);
ASSERT(lpszResourceName != NULL);
HBITMAP hbmp = (HBITMAP) ::LoadImage (
AfxGetResourceHandle (),
lpszResourceName,
IMAGE_BITMAP,
0, 0,
LR_CREATEDIBSECTION);
if (hbmp == NULL)
{
TRACE(_T("Can't load bitmap: %x\n"), uiImageListResID);
return FALSE;
}
CImageList icons;
m_bAlphaBlendIcons = FALSE;
BITMAP bmpObj;
::GetObject (hbmp, sizeof (BITMAP), &bmpObj);
UINT nFlags = (clrTransparent == (COLORREF) -1) ? 0 : ILC_MASK;
switch (bmpObj.bmBitsPixel)
{
case 4:
default:
nFlags |= ILC_COLOR4;
break;
case 8:
nFlags |= ILC_COLOR8;
break;
case 16:
nFlags |= ILC_COLOR16;
break;
case 24:
nFlags |= ILC_COLOR24;
break;
case 32:
nFlags |= ILC_COLOR32;
m_bAlphaBlendIcons = TRUE;
break;
}
icons.Create (cx, bmpObj.bmHeight, nFlags, 0, 0);
icons.Add (CBitmap::FromHandle (hbmp), clrTransparent);
SetIconsList (icons);
return TRUE;
}
示例12: ScaleToFit
HICON CXTPIconHandle::ScaleToFit(HICON hIcon, CSize desiredExtent)
{
if (desiredExtent == CSize(0))
{
// invalid arg
return NULL;
}
CSize realExtent = GetExtent(hIcon);
if (realExtent == CSize(0))
{
// icon destroyed or not created yet
return NULL;
}
// ensure icon retains aspect after scaling
int delta = desiredExtent.cx * realExtent.cy - desiredExtent.cy * realExtent.cx;
if (delta < 0)
{
desiredExtent.cy = MulDiv(realExtent.cy, desiredExtent.cx, realExtent.cx);
}
else
if (delta > 0)
{
desiredExtent.cx = MulDiv(realExtent.cx, desiredExtent.cy, realExtent.cy);
}
// scale the icon
CImageList images;
VERIFY(images.Create(desiredExtent.cx, desiredExtent.cy, ILC_COLOR32 | ILC_MASK, 1, 1));
images.Add(hIcon);
return images.ExtractIcon(0);
}
示例13: fDisableImgListRemap
CPlayerToolBar::CPlayerToolBar()
: fDisableImgListRemap(false)
, m_pButtonsImages(NULL)
, m_hDXVAIcon(NULL)
{
HBITMAP hBmp = CMPCPngImage::LoadExternalImage(L"gpu", IDB_DXVA_ON, IMG_TYPE::UNDEF);
BITMAP bm = { 0 };
::GetObject(hBmp, sizeof(bm), &bm);
if (CMPCPngImage::FileExists(CString(L"gpu")) && (bm.bmHeight > 32 || bm.bmWidth > 32)) {
hBmp = CMPCPngImage::LoadExternalImage(L"", IDB_DXVA_ON, IMG_TYPE::UNDEF);
::GetObject(hBmp, sizeof(bm), &bm);
}
if (bm.bmWidth <= 32 && bm.bmHeight <= 32) {
CBitmap *bmp = DNew CBitmap();
bmp->Attach(hBmp);
CImageList *pButtonDXVA = DNew CImageList();
pButtonDXVA->Create(bm.bmWidth, bm.bmHeight, ILC_COLOR32 | ILC_MASK, 1, 0);
pButtonDXVA->Add(bmp, static_cast<CBitmap*>(NULL));
m_hDXVAIcon = pButtonDXVA->ExtractIcon(0);
delete pButtonDXVA;
delete bmp;
}
iDXVAIconHeight = bm.bmHeight;
iDXVAIconWidth = bm.bmWidth;
DeleteObject(hBmp);
}
示例14: SetTrueColorToolBar
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;
}
示例15: CreateTab
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에서 마지막것만
}
}