本文整理汇总了C++中CImageList::ExtractIcon方法的典型用法代码示例。如果您正苦于以下问题:C++ CImageList::ExtractIcon方法的具体用法?C++ CImageList::ExtractIcon怎么用?C++ CImageList::ExtractIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CImageList
的用法示例。
在下文中一共展示了CImageList::ExtractIcon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: CreateShortcutsBar
BOOL CMainFrame::CreateShortcutsBar ()
{
CMFCOutlookBarTabCtrl::EnableAnimation ();
const int nInitialWidth = 150;
const CString strCaption = _T("Shortcuts");
// <snippet2>
// int nInitialWidth
// CString strCaption
if (!m_wndShortcutsBar.Create (strCaption, this,
CRect (0, 0, nInitialWidth, nInitialWidth),
ID_VIEW_OUTLOOKBAR, WS_CHILD | WS_VISIBLE | CBRS_LEFT))
{
TRACE0("Failed to create outlook bar\n");
return FALSE; // fail to create
}
// </snippet2>
CMFCOutlookBarTabCtrl* pShortcutsBarContainer = DYNAMIC_DOWNCAST (CMFCOutlookBarTabCtrl, m_wndShortcutsBar.GetUnderlyingWindow ());
if (pShortcutsBarContainer == NULL)
{
TRACE0("Cannot get outlook bar container\n");
return FALSE;
}
// <snippet4>
CImageList images;
images.Create (IDB_SHORTCUTS, 32, 0, RGB (255, 0, 255));
// Create first page:
m_wndShortcutsPane1.Create (&m_wndShortcutsBar, AFX_DEFAULT_TOOLBAR_STYLE, ID_SHORTCUTS_PANE_1);
// The this pointer points to a CMainFrame class which extends the CFrameWnd class
m_wndShortcutsPane1.SetOwner (this);
m_wndShortcutsPane1.EnableTextLabels ();
m_wndShortcutsPane1.EnableDocking (CBRS_ALIGN_ANY);
m_wndShortcutsPane1.EnablePageScrollMode();
m_wndShortcutsPane1.SetBackColor(RGB(0,255,0));
m_wndShortcutsPane1.AddButton (images.ExtractIcon (0), _T("View 1"), ID_SHORTCUT_1);
m_wndShortcutsPane1.AddButton (images.ExtractIcon (1), _T("View 2"), ID_SHORTCUT_2);
m_wndShortcutsPane1.AddButton (images.ExtractIcon (2), _T("View 3"), ID_SHORTCUT_3);
m_wndShortcutsPane1.AddButton (images.ExtractIcon (3), _T("View 4"), ID_SHORTCUT_4);
// </snippet4>
pShortcutsBarContainer->AddTab (&m_wndShortcutsPane1, _T("Views"), (UINT)-1, FALSE);
return TRUE;
}
示例3: 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);
}
示例4: 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);
}
示例5: 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;
}
示例6: UpdateCaption
void CTreePropSheet::UpdateCaption()
{
HWND hPage = PropSheet_GetCurrentPageHwnd(GetSafeHwnd());
BOOL bRealPage = IsWindow(hPage) && ::IsWindowVisible(hPage);
HTREEITEM hItem = m_pwndPageTree->GetSelectedItem();
if (!hItem)
return;
CString strCaption = m_pwndPageTree->GetItemText(hItem);
// if empty page, then update empty page message
if (!bRealPage)
m_pFrame->SetMsgText(GenerateEmptyPageMessage(m_strEmptyPageMessage, strCaption));
// if no captions are displayed, cancel here
if (!m_pFrame->GetShowCaption())
return;
// get tab control, to the the images from
CTabCtrl *pTabCtrl = GetTabControl();
if (!IsWindow(pTabCtrl->GetSafeHwnd()))
{
ASSERT(FALSE);
return;
}
if (m_bTreeImages)
{
// get image from tree
int nImage;
m_pwndPageTree->GetItemImage(hItem, nImage, nImage);
HICON hIcon = m_Images.ExtractIcon(nImage);
m_pFrame->SetCaption(strCaption, hIcon);
if (hIcon)
DestroyIcon(hIcon);
}
else if (bRealPage)
{
// get image from hidden (original) tab provided by the original
// implementation
CImageList *pImages = pTabCtrl->GetImageList();
if (pImages)
{
TCITEM ti;
ZeroMemory(&ti, sizeof(ti));
ti.mask = TCIF_IMAGE;
HICON hIcon = NULL;
if (pTabCtrl->GetItem((int)m_pwndPageTree->GetItemData(hItem), &ti))
hIcon = pImages->ExtractIcon(ti.iImage);
m_pFrame->SetCaption(strCaption, hIcon);
if (hIcon)
DestroyIcon(hIcon);
}
else
m_pFrame->SetCaption(strCaption);
}
else
m_pFrame->SetCaption(strCaption);
}
示例7: SetPageIcon
BOOL CTreePropSheet::SetPageIcon(CPropertyPage *pPage, CImageList &Images, int nImage)
{
HICON hIcon = Images.ExtractIcon(nImage);
if (!hIcon)
return FALSE;
return SetPageIcon(pPage, hIcon);
}
示例8: Initialize
void CXTPEditListBoxToolBar::Initialize(bool bAutoFont/*= true*/)
{
// Create the ToolTip control.
m_tooltip.Create(this);
m_tooltip.Activate(TRUE);
CImageList imageList;
imageList.Create(14, 12, ILC_COLOR8 | ILC_MASK, 0, 1);
CBitmap bmp;
CXTPResourceManager::AssertValid(XTPResourceManager()->LoadBitmap(&bmp, XTP_IDB_LISTEDIT));
imageList.Add(&bmp, RGB(255, 0, 255));
for (int i = 0; i < _countof(m_arButton); ++i)
{
if ((!m_bShowNewDeleteButtons) && ((i==0) || (i==1)))
continue;
if ((!m_bShowUpDownButtons) && ((i==2) || (i==3)))
continue;
if (!m_arButton[i].Create(NULL, WS_CHILD | WS_VISIBLE | BS_ICON | BS_CENTER | BS_VCENTER,
CRect(0, 0, 0, 0), this, _arButtonID[i]))
{
TRACE0("Unable to create edit button.\n");
continue;
}
m_arIcon[i] = imageList.ExtractIcon(i);
m_arButton[i].SetIcon(CSize(0), m_arIcon[i]);
CString strToolTip;
CXTPResourceManager::AssertValid(XTPResourceManager()->LoadString(&strToolTip, _arButtonID[i]));
// Add tooltips to group buttons.
m_tooltip.AddTool(&m_arButton[i], strToolTip);
// make sure the button is Windows XP theme compatible using
// the toolbar button theme.
if (m_arButton[i].SetTheme(xtpControlThemeFlat))
{
CXTPButtonTheme* pTheme = m_arButton[i].GetTheme();
if (pTheme)
{
pTheme->EnableToolbarStyle(TRUE);
}
m_arButton[i].SetUseVisualStyle(TRUE);
}
}
// Move the buttons to their correct location.
MoveButtons();
// Set the font for this window.
if (bAutoFont)
{
SetFont(&XTPAuxData().font);
}
}
示例9: AppendStateImages
//------------------------------------------------------------------------
//! Appends the checkbox state images to the list control image list
//!
//! @param owner The list control adding column
//! @param imagelist The image list assigned to the list control
//! @return Image index where the two state images (unchecked/checked) was inserted
//------------------------------------------------------------------------
int CGridColumnTraitImage::AppendStateImages(CGridListCtrlEx& owner, CImageList& imagelist)
{
if (!(owner.GetExtendedStyle() & LVS_EX_SUBITEMIMAGES))
owner.SetExtendedStyle(owner.GetExtendedStyle() | LVS_EX_SUBITEMIMAGES);
if (!imagelist)
imagelist.Create(16, 16, ILC_COLOR16 | ILC_MASK, 1, 0);
if (!owner.GetImageList(LVSIL_SMALL))
owner.SetImageList(&imagelist, LVSIL_SMALL);
VERIFY( owner.GetImageList(LVSIL_SMALL)==&imagelist );
bool createdStateImages = false;
CImageList* pStateList = owner.GetImageList(LVSIL_STATE);
if (pStateList==NULL)
{
if (!(owner.GetExtendedStyle() & LVS_EX_CHECKBOXES))
{
createdStateImages = true;
owner.SetExtendedStyle(owner.GetExtendedStyle() | LVS_EX_CHECKBOXES);
pStateList = owner.GetImageList(LVSIL_STATE);
}
}
int imageCount = -1;
ASSERT(pStateList!=NULL);
if (pStateList!=NULL)
{
imageCount = imagelist.GetImageCount();
HICON uncheckedIcon = pStateList->ExtractIcon(0);
imagelist.Add(uncheckedIcon);
DestroyIcon(uncheckedIcon);
HICON checkedIcon = pStateList->ExtractIcon(1);
imagelist.Add(checkedIcon);
DestroyIcon(checkedIcon);
}
if (createdStateImages)
owner.SetExtendedStyle(owner.GetExtendedStyle() & ~LVS_EX_CHECKBOXES);
return imageCount;
}
示例10: InsertPage
BOOL COXCustomizeManager::InsertPage(COXCustomizePage* pCustomizePage,
int nPageIndex)
{
ASSERT(pCustomizePage!=NULL);
CString sTitle=pCustomizePage->GetTitle();
LPCTSTR lpszImageResource=pCustomizePage->GetImageResource();
COLORREF clrMask=pCustomizePage->GetImageMask();
CString sTooltip=pCustomizePage->GetTooltip();
CString sGroup=pCustomizePage->GetGroup();
#ifdef _DEBUG
ASSERT(nPageIndex>=0 && nPageIndex<=GetPageCount(sGroup));
HSHBGROUP hGroupTest=NULL;
int nIndexTest=-1;
ASSERT(!FindPage(pCustomizePage,hGroupTest,nIndexTest));
ASSERT(!FindPage(sTitle,sGroup,hGroupTest,nIndexTest));
#endif
// find/create the corresponding shortcut bar group
HSHBGROUP hGroup=m_shb.FindGroupByTitle(sGroup);
BOOL bNewGroup=FALSE;
if(hGroup==NULL)
{
hGroup=m_shb.InsertGroup(sGroup);
bNewGroup=TRUE;
}
if(hGroup==NULL)
{
TRACE(_T("COXCustomizeManager::InsertPage: failed to create group for the specified page\n"));
if(bNewGroup)
m_shb.DeleteGroup(hGroup);
return FALSE;
}
// associate image list with the created group
m_shb.SetLCImageList(hGroup,&m_ilShortcutBar,LVSIL_NORMAL);
// get image index for new page
int nImageIndex=-1;
if(lpszImageResource!=NULL)
{
CImageList imageList;
if(!imageList.Create(lpszImageResource,32,0,clrMask))
{
TRACE(_T("COXCustomizeManager::InsertPage: failed to extract image for new page\n"));
if(bNewGroup)
{
m_shb.DeleteGroup(hGroup);
}
return FALSE;
}
HICON hIcon=imageList.ExtractIcon(0);
ASSERT(hIcon!=NULL);
nImageIndex=m_ilShortcutBar.Add(hIcon);
ASSERT(nImageIndex!=-1);
VERIFY(::DestroyIcon(hIcon));
}
int nItem=m_shb.InsertLCItem(hGroup,nPageIndex,sTitle,nImageIndex,
(LPARAM)pCustomizePage);
if(nItem==-1)
{
TRACE(_T("COXCustomizeManager::InsertPage: failed to insert new item into the shortcut bar\n"));
if(bNewGroup)
{
m_shb.DeleteGroup(hGroup);
}
return FALSE;
}
m_mapPages.SetAt(pCustomizePage,((PtrToLong(hGroup))<<16)+nItem);
m_mapTooltips.SetAt(pCustomizePage,sTooltip);
return TRUE;
}
示例11: OnInitialUpdate
//----- OnInitialUpdate() ---------------------------------------------------
void CFormChunkMergeView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
// initialize GUI (icons, texts, read-only)
CImageList* pImageList (CFDResourceManager::getInstance()->getImageListBrowse());
CImageList* pImageListDis(CFDResourceManager::getInstance()->getImageListOtherDis());
((CMFCButton*) GetDlgItem(IDC_BT_FILE_IN)) ->SetImage(pImageList->ExtractIcon(1));
((CMFCButton*) GetDlgItem(IDC_BT_FILE_COLL))->SetImage(pImageList->ExtractIcon(1));
/*
((CEdit*) ((CComboBox*) GetDlgItem(IDC_CB_TEMPLATE)) ->GetDlgItem(1001))->SetReadOnly();
((CEdit*) ((CComboBox*) GetDlgItem(IDC_CB_MAT_SINGLE))->GetDlgItem(1001))->SetReadOnly();
*/
::SetWindowTheme(GetDlgItem(IDC_GBOX_FILES) ->GetSafeHwnd(), _T(""), _T(""));
::SetWindowTheme(GetDlgItem(IDC_GBOX_HINTS) ->GetSafeHwnd(), _T(""), _T(""));
::SetWindowTheme(GetDlgItem(IDC_GBOX_COLLISION)->GetSafeHwnd(), _T(""), _T(""));
::SetWindowTheme(GetDlgItem(IDC_GBOX_MATERIAL) ->GetSafeHwnd(), _T(""), _T(""));
::SetWindowTheme(GetDlgItem(IDC_GBOX_HANDLING) ->GetSafeHwnd(), _T(""), _T(""));
pImageList = CFDResourceManager::getInstance()->getImageListNumbers();
for (short i(1); i < 6; ++i)
{
((CStatic*) GetDlgItem(IDC_PC_NUM_0+i)) ->SetIcon(pImageList->ExtractIcon(i));
((CStatic*) GetDlgItem(IDC_PC_HINT_0+i))->SetIcon(pImageList->ExtractIcon(i));
}
pImageList = CFDResourceManager::getInstance()->getImageListOther();
((CMFCButton*) GetDlgItem(IDC_BT_CONVERT)) ->SetImage(pImageList->ExtractIcon(0));
((CMFCButton*) GetDlgItem(IDC_BT_MAT_DEFINE)) ->SetImage(pImageList->ExtractIcon(7), true, NULL, pImageListDis->ExtractIcon(7));
((CMFCButton*) GetDlgItem(IDC_BT_RESET_FORM)) ->SetImage(pImageList->ExtractIcon(2));
((CMFCButton*) GetDlgItem(IDC_BT_VIEW_IN)) ->SetImage(pImageList->ExtractIcon(4), true, NULL, pImageListDis->ExtractIcon(4));
((CMFCButton*) GetDlgItem(IDC_BT_VIEW_COLL)) ->SetImage(pImageList->ExtractIcon(4), true, NULL, pImageListDis->ExtractIcon(4));
((CMFCButton*) GetDlgItem(IDC_BT_TEMPLATE)) ->SetImage(pImageList->ExtractIcon(3));
((CMFCButton*) GetDlgItem(IDC_BT_NSCOPE_IN)) ->SetImage(pImageList->ExtractIcon(10), true, NULL, pImageListDis->ExtractIcon(10));
((CMFCButton*) GetDlgItem(IDC_BT_NSCOPE_COLL))->SetImage(pImageList->ExtractIcon(10), true, NULL, pImageListDis->ExtractIcon(10));
GetDlgItem(IDC_BT_VIEW_IN) ->EnableWindow(FALSE);
GetDlgItem(IDC_BT_NSCOPE_IN) ->EnableWindow(FALSE);
GetDlgItem(IDC_BT_VIEW_COLL) ->EnableWindow(FALSE);
GetDlgItem(IDC_BT_NSCOPE_COLL) ->EnableWindow(FALSE);
GetDlgItem(IDC_RD_COLL_LOCAL) ->EnableWindow(FALSE);
GetDlgItem(IDC_RD_COLL_GLOBAL) ->EnableWindow(FALSE);
GetDlgItem(IDC_CK_REORDER_TRIS)->EnableWindow(FALSE);
// initialize log view
CRichEditCtrl* pLogView((CRichEditCtrl*) GetDlgItem(IDC_RE_LOG));
CHARFORMAT cf = { 0 };
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_FACE | CFM_SIZE | CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_STRIKEOUT | CFM_PROTECTED;
cf.dwEffects = 0;
cf.yHeight = 127;
lstrcpy(cf.szFaceName, _T("Small Fonts"));
pLogView->SetDefaultCharFormat(cf);
pLogView->SetReadOnly (TRUE);
if (Configuration::getInstance()->_lvwLogActive[0])
{
pLogView->SetBackgroundColor(FALSE, Configuration::getInstance()->_lvwColors[0]);
}
// prepare tool tips
if (_toolTipCtrl.Create(this, TTS_USEVISUALSTYLE | TTS_BALLOON))
{
for (short i(0); glToolTiplist[i]._uid != -1; ++i)
{
_toolTipCtrl.AddTool(GetDlgItem(glToolTiplist[i]._uid), CString(glToolTiplist[i]._text.c_str()));
}
_toolTipCtrl.SetMaxTipWidth(260);
_toolTipCtrl.Activate(Configuration::getInstance()->_showToolTipps);
}
// set settings from configuration
BroadcastEvent(IBCE_CHANGED_SETTINGS);
// disable 'defining materials' until working
GetDlgItem(IDC_RD_MAT_DEFINE)->EnableWindow(FALSE);
}
示例12: OnInitialUpdate
//----- OnInitialUpdate() ---------------------------------------------------
void CFormBlenderPrepareView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
// initialize GUI (icons, texts, read-only)
CImageList* pImageList (CFDResourceManager::getInstance()->getImageListBrowse());
CImageList* pImageListDis(CFDResourceManager::getInstance()->getImageListOtherDis());
((CMFCButton*) GetDlgItem(IDC_BT_FILE_IN)) ->SetImage(pImageList->ExtractIcon(1));
((CMFCButton*) GetDlgItem(IDC_BT_FILE_OUT))->SetImage(pImageList->ExtractIcon(1));
::SetWindowTheme(GetDlgItem(IDC_GBOX_FILES)->GetSafeHwnd(), _T(""), _T(""));
::SetWindowTheme(GetDlgItem(IDC_GBOX_HINTS)->GetSafeHwnd(), _T(""), _T(""));
::SetWindowTheme(GetDlgItem(IDC_GBOX_TOOLS)->GetSafeHwnd(), _T(""), _T(""));
pImageList = CFDResourceManager::getInstance()->getImageListNumbers();
for (short i(1); i < 5; ++i)
{
if (i != 3)
{
((CStatic*) GetDlgItem(IDC_PC_NUM_0+i))->SetIcon(pImageList->ExtractIcon(i));
}
((CStatic*) GetDlgItem(IDC_PC_HINT_0+i))->SetIcon(pImageList->ExtractIcon(i));
}
pImageList = CFDResourceManager::getInstance()->getImageListOther();
((CMFCButton*) GetDlgItem(IDC_BT_CONVERT)) ->SetImage(pImageList->ExtractIcon(0));
((CMFCButton*) GetDlgItem(IDC_BT_RESET_FORM)) ->SetImage(pImageList->ExtractIcon(2));
((CMFCButton*) GetDlgItem(IDC_BT_VIEW_IN)) ->SetImage(pImageList->ExtractIcon(4), true, NULL, pImageListDis->ExtractIcon(4));
((CMFCButton*) GetDlgItem(IDC_BT_VIEW_OUT)) ->SetImage(pImageList->ExtractIcon(4), true, NULL, pImageListDis->ExtractIcon(4));
((CMFCButton*) GetDlgItem(IDC_BT_NSCOPE_IN)) ->SetImage(pImageList->ExtractIcon(10), true, NULL, pImageListDis->ExtractIcon(10));
((CMFCButton*) GetDlgItem(IDC_BT_NSCOPE_OUT)) ->SetImage(pImageList->ExtractIcon(10), true, NULL, pImageListDis->ExtractIcon(10));
GetDlgItem(IDC_BT_VIEW_IN) ->EnableWindow(FALSE);
GetDlgItem(IDC_BT_NSCOPE_IN) ->EnableWindow(FALSE);
GetDlgItem(IDC_BT_VIEW_OUT) ->EnableWindow(FALSE);
GetDlgItem(IDC_BT_NSCOPE_OUT)->EnableWindow(FALSE);
// initialize log view
CRichEditCtrl* pLogView((CRichEditCtrl*) GetDlgItem(IDC_RE_LOG));
CHARFORMAT cf = { 0 };
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_FACE | CFM_SIZE | CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_STRIKEOUT | CFM_PROTECTED;
cf.dwEffects = 0;
cf.yHeight = 127;
lstrcpy(cf.szFaceName, _T("Small Fonts"));
pLogView->SetDefaultCharFormat(cf);
pLogView->SetReadOnly (TRUE);
if (Configuration::getInstance()->_lvwLogActive[0])
{
pLogView->SetBackgroundColor(FALSE, Configuration::getInstance()->_lvwColors[0]);
}
// create initial sub form
CRect tRect;
GetDlgItem(IDC_SUBFORM_BOX)->GetWindowRect(&tRect);
_subFormList.SetPosition (tRect);
_subFormList.CreateSubForm(IDD_SUB_ARMOR_BLENDER, this, new CSubFormArmorBlender());
_subFormList.CreateSubForm(IDD_SUB_BLENDER_ARMOR, this, new CSubFormBlenderArmor());
_subFormList.ShowSubForm (0);
// prepare tool tips
if (_toolTipCtrl.Create(this, TTS_USEVISUALSTYLE | TTS_BALLOON))
{
for (short i(0); glToolTiplist[i]._uid != -1; ++i)
{
_toolTipCtrl.AddTool(GetDlgItem(glToolTiplist[i]._uid), CString(glToolTiplist[i]._text.c_str()));
}
_toolTipCtrl.SetMaxTipWidth(260);
_toolTipCtrl.Activate(Configuration::getInstance()->_showToolTipps);
}
// set settings from configuration
BroadcastEvent(IBCE_CHANGED_SETTINGS);
}
示例13: OnCreate
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
TRACE("CMainFrame::OnCreate");
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
OnAppLook (m_nAppLook);
CMFCToolBar::EnableQuickCustomization ();
UpdateMDITabs (FALSE);
if (!m_wndMenuBar.Create (this))
{
TRACE0("Failed to create menubar\n");
return -1; // fail to create
}
m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC);
// Prevent the menu bar from taking the focus on activation
CMFCPopupMenu::SetForceMenuFocus(FALSE);
// Detect color depth. 256 color toolbars can be used in the
// high or true color modes only (bits per pixel is > 8):
CClientDC dc (this);
BOOL bIsHighColor = dc.GetDeviceCaps (BITSPIXEL) > 8;
UINT uiToolbarHotID = bIsHighColor ? IDB_TOOLBAR256 : 0;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME, 0, 0, FALSE, 0, 0, uiToolbarHotID))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndToolBarTheme.Create(this, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, ID_VIEW_THEME_TOOLBAR) ||
!m_wndToolBarTheme.LoadToolBar (IDR_THEME, 0, 0, TRUE /* Locked */))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
CImageList imagesWorkspace;
imagesWorkspace.Create (IDB_WORKSPACE, 16, 0, RGB (255, 0, 255));
if (!m_wndWorkSpace.Create (_T("MDI Tabs Options"), this, CRect (0, 0, 300, 300),
TRUE, ID_VIEW_WORKSPACE,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{
TRACE0("Failed to create Workspace bar\n");
return FALSE; // fail to create
}
m_wndWorkSpace.SetIcon (imagesWorkspace.ExtractIcon (0), FALSE);
if (!m_wndWorkSpace2.Create (_T("My Second Tab Options"), this, CRect (0, 0, 300, 300),
TRUE, ID_VIEW_WORKSPACE2,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{
TRACE0("Failed to create Workspace bar\n");
return FALSE; // fail to create
}
m_wndWorkSpace2.SetIcon (imagesWorkspace.ExtractIcon (0), FALSE);
m_wndToolBar.SetWindowText (_T("Standard"));
m_wndToolBarTheme.SetWindowText (_T("Visual Style"));
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
m_wndToolBarTheme.EnableDocking(CBRS_ALIGN_ANY);
m_wndWorkSpace.EnableDocking(CBRS_ALIGN_ANY);
m_wndWorkSpace2.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
EnableAutoHidePanes(CBRS_ALIGN_ANY);
DockPane(&m_wndMenuBar);
DockPane(&m_wndToolBar);
DockPane(&m_wndToolBarTheme);
DockPane (&m_wndWorkSpace);
DockPane (&m_wndWorkSpace2);
m_wndToolBar.EnableCustomizeButton (TRUE, ID_VIEW_CUSTOMIZE, _T("Customize..."));
m_wndToolBarTheme.EnableCustomizeButton (TRUE, -1, _T(""));
// Enable windows manager:
EnableWindowsDialog (ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE);
//.........这里部分代码省略.........
示例14: RefillPageTree
void CTreePropSheetBase::RefillPageTree()
{
if (!IsWindow(m_hWnd))
return;
// TreePropSheetEx: OnPageTreeSelChanging does not process message.
TreePropSheet::CIncrementScope RefillingPageTreeContentGuard( m_nRefillingPageTreeContent );
// TreePropSheetEx: End OnPageTreeSelChanging does not process message.
m_pwndPageTree->DeleteAllItems();
CTabCtrl *pTabCtrl = GetTabControl();
if (!IsWindow(pTabCtrl->GetSafeHwnd()))
{
ASSERT(FALSE);
return;
}
const int nPageCount = pTabCtrl->GetItemCount();
// rebuild image list
if (m_bTreeImages)
{
for (int i = m_Images.GetImageCount()-1; i >= 0; --i)
m_Images.Remove(i);
// add page images
CImageList *pPageImages = pTabCtrl->GetImageList();
if (pPageImages)
{
for (int nImage = 0; nImage < pPageImages->GetImageCount(); ++nImage)
{
HICON hIcon = pPageImages->ExtractIcon(nImage);
m_Images.Add(hIcon);
DestroyIcon(hIcon);
}
}
// add default images
if (m_DefaultImages.GetSafeHandle())
{
HICON hIcon;
// add default images
hIcon = m_DefaultImages.ExtractIcon(0);
if (hIcon)
{
m_Images.Add(hIcon);
DestroyIcon(hIcon);
}
hIcon = m_DefaultImages.ExtractIcon(1);
{
m_Images.Add(hIcon);
DestroyIcon(hIcon);
}
}
}
// insert tree items
for (int nPage = 0; nPage < nPageCount; ++nPage)
{
// Get title and image of the page
CString strPagePath;
TCITEM ti;
ZeroMemory(&ti, sizeof(ti));
ti.mask = TCIF_TEXT|TCIF_IMAGE;
ti.cchTextMax = MAX_PATH;
ti.pszText = strPagePath.GetBuffer(ti.cchTextMax);
ASSERT(ti.pszText);
if (!ti.pszText)
return;
pTabCtrl->GetItem(nPage, &ti);
strPagePath.ReleaseBuffer();
// Create an item in the tree for the page
HTREEITEM hItem = CreatePageTreeItem(ti.pszText);
ASSERT(hItem);
if (hItem)
{
m_pwndPageTree->SetItemData(hItem, nPage);
// set image
if (m_bTreeImages)
{
int nImage = ti.iImage;
if (nImage < 0 || nImage >= m_Images.GetImageCount())
nImage = m_DefaultImages.GetSafeHandle()? m_Images.GetImageCount()-1 : -1;
m_pwndPageTree->SetItemImage(hItem, nImage, nImage);
}
// Set font if disabled.
CPropertyPage* pPage = GetPage( nPage );
ASSERT( pPage );
if( NULL != pPage && !IsPageEnabled( pPage ) )
{
::SendMessage( m_pwndPageTree->GetSafeHwnd(), WMU_ENABLETREEITEM, (WPARAM)hItem, (LPARAM)GetSysColor(COLOR_GRAYTEXT) );
}
//.........这里部分代码省略.........
示例15: RefillPageTree
void CTreePropSheet::RefillPageTree()
{
if (!IsWindow(m_hWnd))
return;
m_pwndPageTree->DeleteAllItems();
CTabCtrl *pTabCtrl = GetTabControl();
if (!IsWindow(pTabCtrl->GetSafeHwnd()))
{
ASSERT(FALSE);
return;
}
const int nPageCount = pTabCtrl->GetItemCount();
// rebuild image list
if (m_bTreeImages)
{
for (int i = m_Images.GetImageCount()-1; i >= 0; --i)
m_Images.Remove(i);
// add page images
CImageList *pPageImages = pTabCtrl->GetImageList();
if (pPageImages)
{
for (int nImage = 0; nImage < pPageImages->GetImageCount(); ++nImage)
{
HICON hIcon = pPageImages->ExtractIcon(nImage);
m_Images.Add(hIcon);
DestroyIcon(hIcon);
}
}
// add default images
if (m_DefaultImages.GetSafeHandle())
{
HICON hIcon;
// add default images
hIcon = m_DefaultImages.ExtractIcon(0);
if (hIcon)
{
m_Images.Add(hIcon);
DestroyIcon(hIcon);
}
hIcon = m_DefaultImages.ExtractIcon(1);
{
m_Images.Add(hIcon);
DestroyIcon(hIcon);
}
}
}
// insert tree items
for (int nPage = 0; nPage < nPageCount; ++nPage)
{
// Get title and image of the page
CString strPagePath;
TCITEM ti;
ZeroMemory(&ti, sizeof(ti));
ti.mask = TCIF_TEXT|TCIF_IMAGE;
ti.cchTextMax = MAX_PATH;
ti.pszText = strPagePath.GetBuffer(ti.cchTextMax);
ASSERT(ti.pszText);
if (!ti.pszText)
return;
pTabCtrl->GetItem(nPage, &ti);
strPagePath.ReleaseBuffer();
// Create an item in the tree for the page
HTREEITEM hItem = CreatePageTreeItem(ti.pszText);
ASSERT(hItem);
if (hItem)
{
m_pwndPageTree->SetItemData(hItem, nPage);
// set image
if (m_bTreeImages)
{
int nImage = ti.iImage;
if (nImage < 0 || nImage >= m_Images.GetImageCount())
nImage = m_DefaultImages.GetSafeHandle()? m_Images.GetImageCount()-1 : -1;
m_pwndPageTree->SetItemImage(hItem, nImage, nImage);
}
}
}
}