本文整理汇总了C++中CImageList::CreateFromImage方法的典型用法代码示例。如果您正苦于以下问题:C++ CImageList::CreateFromImage方法的具体用法?C++ CImageList::CreateFromImage怎么用?C++ CImageList::CreateFromImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CImageList
的用法示例。
在下文中一共展示了CImageList::CreateFromImage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnCreate
LRESULT RecipesView::OnCreate(LPCREATESTRUCT createStruct)
{
DWORD style = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
/*
m_listview.Create(m_hWnd, rcDefault, NULL, style | LVS_REPORT | LVS_SINGLESEL, WS_EX_CLIENTEDGE);*/
m_recipePanel.Create(m_hWnd);
m_recipePanel.ShowWindow(SW_SHOWNOACTIVATE);
m_filterConnection = m_recipePanel.connectSettingsChanged(boost::bind(&RecipesView::onFilterSettingsChanged, this));
/*
m_buttonRefresh.Create(m_hWnd);
m_buttonRefresh.ShowWindow(SW_SHOWNOACTIVATE);*/
m_webview.Create(m_hWnd);
// m_webview.ShowWindow(SW_SHOWNOACTIVATE);
m_webview.SetHTML(_T("<html><body></body></html>"));
CImageList imageList;
imageList.CreateFromImage(IDB_PATTERNMATCH_VIEW, 16, 1, CLR_DEFAULT, IMAGE_BITMAP,
LR_CREATEDIBSECTION | LR_DEFAULTSIZE);
m_toolbar.Create(GetTopLevelWindow(), NULL, _T("RecipesViewToolBar"),
ATL_SIMPLE_TOOLBAR_PANE_STYLE | TBSTYLE_LIST,
TBSTYLE_EX_MIXEDBUTTONS);
m_toolbar.SetButtonStructSize();
m_toolbar.SetImageList(imageList);
m_toolbar.AutoSize();
return 0;
}
示例2: onCreate
LRESULT IdentifyView::onCreate(LPCREATESTRUCT createStruct)
{
RECT myRect = { 0, 0, createStruct->cx, createStruct->cy };
//RECT identRect = { 0, 0, 250, createStruct->cy };
//RECT gridRect = { 250, 0, createStruct->cx, createStruct->cy };
DWORD splitterStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
// Create child windows
m_splitter.Create(m_hWnd, myRect, NULL, splitterStyle);
m_splitter.SetSplitterExtendedStyle(0);
m_splitter.SetDlgCtrlID(IDW_SPLITTER);
DWORD gridStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_OWNERDATA;
m_identifyList->Create(m_splitter.m_hWnd, rcDefault, NULL, gridStyle, WS_EX_CLIENTEDGE);
m_identifyList->SetDlgCtrlID(IDW_IDENTLIST);
m_datagrid->Create(m_splitter.m_hWnd, rcDefault, NULL, gridStyle, WS_EX_CLIENTEDGE);
m_datagrid->SetDlgCtrlID(IDW_DATAGRID);
m_splitter.SetSplitterPanes(m_identifyList->m_hWnd, m_datagrid->m_hWnd);
m_splitter.SetActivePane(SPLIT_PANE_LEFT);
m_splitter.SetSplitterPos(250);
// Assign a datamodel to the list of identifyables.
m_identifyListModel.reset(new IdentifyListDataModel(m_db));
m_identifyList->setModel(m_identifyListModel);
m_identifyList->autosizeColumnsUseData();
DlgResize_Init(false, false);
// Build the toolbar
TBBUTTON buttons[1];
buttons[0].iBitmap = 0;
buttons[0].idCommand = ID_HELP;
buttons[0].fsState = TBSTATE_ENABLED;
buttons[0].fsStyle = TBSTYLE_BUTTON | BTNS_SHOWTEXT | BTNS_AUTOSIZE;
buttons[0].dwData = NULL;
buttons[0].iString = (INT_PTR)_T("Help");
CImageList imageList;
imageList.CreateFromImage(IDB_IDENTIFY_VIEW, 16, 1, CLR_DEFAULT, IMAGE_BITMAP, LR_CREATEDIBSECTION | LR_DEFAULTSIZE);
m_toolbar.Create(GetTopLevelWindow(), NULL, _T("IdentifyViewToolBar"),
ATL_SIMPLE_TOOLBAR_PANE_STYLE | TBSTYLE_LIST,
TBSTYLE_EX_MIXEDBUTTONS);
m_toolbar.SetButtonStructSize();
m_toolbar.SetImageList(imageList);
m_toolbar.AddButtons(ARRAYSIZE(buttons), buttons);
m_toolbar.AutoSize();
return 0;
}
示例3: OnCreate
LRESULT CSearchBarView::OnCreate(LPCREATESTRUCT lpcs)
{
ATLVERIFY(m_ctrlEditorView.Create(*this, rcDefault, NULL, CHILD_WND_STYLE));
m_ctrlEditorView.ModifyStyle(0, ES_LEFT | ES_AUTOHSCROLL | ES_VERTICAL);
// Set up the bitmap buttons.
ATLVERIFY(m_btnSearch.Create(*this, rcDefault, NULL, CHILD_WND_STYLE));
CImageList iml;
iml.CreateFromImage(IDB_BITMAP3, 40, 0, CLR_NONE, IMAGE_BITMAP,
LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS | LR_CREATEDIBSECTION);
m_btnSearch.SetImageList(iml.Detach());
m_btnSearch.SetImages(0, 3, 1, 2);
m_btnSearch.SetBitmapButtonExtendedStyle(BMPBTN_HOVER, BMPBTN_HOVER);
SetMsgHandled(false);
return 0;
}
示例4: OnCreate
LRESULT CMainFrame::OnCreate(LPCREATESTRUCT /*lParam*/)
{
//
// create command bar window
//
HWND hWndCmdBar = m_CmdBar.Create(
m_hWnd,
rcDefault,
NULL,
ATL_SIMPLE_CMDBAR_PANE_STYLE);
// attach menu
m_CmdBar.AttachMenu(GetMenu());
// load command bar images
m_CmdBar.SetImageSize(CSize(9,9));
// m_CmdBar.LoadImages(IDR_MAINFRAME);
// remove old menu
SetMenu(NULL);
// set title
CString strTitle;
strTitle.LoadString( IDS_APPLICATION );
SetWindowText(strTitle);
//
// setting up a tool bar
//
// patria:
//
// We are loading an empty tool bar.
// If we directly load a tool bar using a bitmap which does not
// match with windows system palette, the application may crash
// in Windows 2000.
// As an workaround, we just create a simple tool bar with
// an empty bitmap and replace them later.
//
HWND hWndToolBar = CreateSimpleToolBarCtrl(
m_hWnd,
IDR_EMPTY_TOOLBAR,
FALSE,
ATL_SIMPLE_TOOLBAR_PANE_STYLE | TBSTYLE_LIST);
m_wndToolBar.Attach( hWndToolBar );
m_wndToolBar.SetExtendedStyle( TBSTYLE_EX_MIXEDBUTTONS | TBSTYLE_EX_DRAWDDARROWS );
//
// patria:
//
// Some bitmaps are distorted when used with TB_ADDBITMAP
// which is sent from CreateSimpleToolBarCtrl when the bitmap is not true color.
// This is the case with IO-DATA's tool bar image.
// As an workaround, we can directly create a image list directly
// and replace the image list of the tool bar, which corrects such misbehaviors.
//
{
CImageList imageList;
WORD wWidth = 32; // we are using 32 x 32 buttons
imageList.CreateFromImage(
IDR_MAINFRAME,
wWidth,
1,
CLR_DEFAULT,
IMAGE_BITMAP,
LR_CREATEDIBSECTION | LR_DEFAULTSIZE);
m_wndToolBar.SetImageList(imageList);
}
TBBUTTON tbButton = { 0 };
TBBUTTONINFO tbButtonInfo = { 0 };
TBREPLACEBITMAP replaceBitmap = { 0 };
// Add strings to the tool bar
m_wndToolBar.SetButtonStructSize(sizeof(TBBUTTON));
for ( int i=0; i < m_wndToolBar.GetButtonCount(); i++ )
{
CString strCommand;
m_wndToolBar.GetButton( i, &tbButton );
tbButtonInfo.cbSize = sizeof(TBBUTTONINFO);
tbButtonInfo.dwMask = TBIF_STYLE;
m_wndToolBar.GetButtonInfo( tbButton.idCommand, &tbButtonInfo );
tbButtonInfo.dwMask = TBIF_TEXT | TBIF_STYLE;
strCommand.LoadString( tbButton.idCommand );
strCommand = strCommand.Right(
strCommand.GetLength() - strCommand.Find('\n') - 1
);
tbButtonInfo.pszText =
const_cast<LPTSTR>(static_cast<LPCTSTR>(strCommand));
tbButtonInfo.cchText = strCommand.GetLength();
tbButtonInfo.fsStyle |= BTNS_SHOWTEXT | BTNS_AUTOSIZE;
m_wndToolBar.AddString( tbButton.idCommand );
m_wndToolBar.SetButtonInfo( tbButton.idCommand, &tbButtonInfo );
}
#define ATL_CUSTOM_REBAR_STYLE \
((ATL_SIMPLE_REBAR_STYLE & ~RBS_AUTOSIZE) | CCS_NODIVIDER)
//
// patria: reason to use ATL_CUSTOM_REBAR_STYLE
//
//.........这里部分代码省略.........
示例5: OnActivate
void CPlugin::OnActivate( void )
{
OutputDebugString("CPlugin::OnActivate() called\n");
sys_Printf(BIC_INFO,"%s Plugin by %s Activated\n", m_Name, m_Author);
// do activation/initialisation code here
g_ImageListID = HydraIRC_GetNewImageListID();
int i;
for (i = 0 ; i < TOOLBAR_BUTTON_COUNT; i ++)
ToolbarIDs[i] = HydraIRC_GetNewToolbarID();
/*
g_hToolbarImageList = HydraIRC_GetToolbarImageList();
if (g_hToolbarImageList)
{
g_ToolbarImageList.Attach(g_hToolbarImageList);
g_FirstImage = g_ToolbarImageList.GetImageCount();
g_ToolbarBitmap.LoadBitmap(IDB_TOOLBAR);
g_ToolbarImageList.Add( g_ToolbarBitmap, RGB(255,0,255));
g_LastImage = g_ToolbarImageList.GetImageCount() - 1;
}
else
sys_Printf(BIC_ERROR,"%s: Failed to get imagelist!\n",Plugin.m_Name);
*/
#ifdef HYDRAIRC_0.3.163
/*
In HydraIRC <= 0.3.163 HydraIRC_GetToolbar returned the HWND of the toolbar itself
but attachking a ReBar and Using GetBandInfo no-longer worked (probably due to WTL 8 changes)
so in 0.3.164 it has been changed to returning the actual child window the holds the buttons.
*/
g_hToolBarWnd = HydraIRC_GetToolbar();
if (!g_hToolBarWnd) {
sys_Printf(BIC_ERROR,"%s: Failed to get toolbar window!\n",Plugin.m_Name);
return;
}
g_Rebar.Attach(g_hToolBarWnd);
//REBARBANDINFO rbbi = { sizeof(REBARBANDINFO), RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_STYLE };
REBARBANDINFO rbbi = { sizeof(REBARBANDINFO), RBBIM_CHILD };
if (g_Rebar.GetBandInfo(1,&rbbi) == 0) {
sys_Printf(BIC_ERROR,"%s: Failed to get toolbar band info!\n",Plugin.m_Name);
return;
}
g_Toolbar.Attach(rbbi.hwndChild);
#else
HWND toolbarChild = HydraIRC_GetToolbar();
if (!toolbarChild) {
sys_Printf(BIC_ERROR,"%s: Failed to get toolbar band info!\n",Plugin.m_Name);
return;
}
g_Toolbar.Attach(toolbarChild);
#endif
//g_ToolbarBitmap.LoadBitmap(IDB_TOOLBAR);
//g_ToolbarImageList.Add( g_ToolbarBitmap, RGB(255,0,255));
g_ToolbarImageList.CreateFromImage(IDB_TOOLBAR, 16, 17, RGB(255,0,255), IMAGE_BITMAP, LR_CREATEDIBSECTION | LR_SHARED);
g_Toolbar.SetImageList(g_ToolbarImageList,g_ImageListID);
//g_ToolbarImageList.Add( g_ToolbarBitmap, RGB(255,0,255));
TBBUTTON tb[TOOLBAR_BUTTON_COUNT];
memset(tb, 0, sizeof(tb));
int n = 0, image = 0;//g_FirstImage;
tb[n].iBitmap = 0;
tb[n].idCommand = ToolbarIDs[n];
tb[n].fsState = TBSTATE_ENABLED;
tb[n].fsStyle = TBSTYLE_SEP;
n++;
tb[n].iBitmap = MAKELONG(image++,g_ImageListID);
tb[n].idCommand = ToolbarIDs[n];
tb[n].fsState = TBSTATE_ENABLED;
tb[n].fsStyle = TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE;
//tb[n].iString = (int)("Show Winamp song\0");
g_ButtonsAdded = g_Toolbar.AddButtons(TOOLBAR_BUTTON_COUNT,tb);
// TODO: force a recalcuate of the toolbar's ideal size
// see WTL::CFrameWindowImplBase::AddSimpleReBarBandCtrl
// the bit where it calculates the size.
}
示例6: InitImageList
void CClassView::InitImageList()
{
CImageList il;
il.CreateFromImage(IDB_PROJIMAGE, 16, 1, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION);
SetImageList(il);
}