CMFCToolBarButton//第二个参数怎么关联图像列表的索引?

mirroatl15 2012-11-07 11:41:48

//CMFCToolBarButton//第二个参数怎么关联Image图像列表的索引?
m_wndToolBar.SetUserImage(&m_UserImages); //CMFCToolBar m_wndToolbar

CMFCToolBarButton(
UINT uiID,
int iImage,
LPCTSTR lpszText=NULL,
BOOL bUserButton=FALSE,
BOOL bLocked=FALSE
);


Parameters
[in] uiID
The command ID of the button.

[in] iImage
The image index of the button in the collection of images.

[in] lpszText
The text label of the button. Can be NULL.

[in] bUserButton
A Boolean value that determines whether the button is user-defined. If this parameter is TRUE, the button is user-defined. Otherwise, the button image is loaded from a resource.

[in] bLocked
A Boolean value that determines whether the button can be customized. If this parameter is TRUE, the button cannot be customized. Otherwise, the button can be customized.
...全文
288 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
hztj2005 2012-11-08
  • 打赏
  • 举报
回复
m_wndToolBar中有一个 immediate adjust什么的函数,调用一下试试。
schlafenhamster 2012-11-07
  • 打赏
  • 举报
回复
m_wndToolBar.SetUserImage(&m_UserImages); 这是整个集 [in] iImage The image index of the button in the collection of images. 就是整个集里索引。
傻X 2012-11-07
  • 打赏
  • 举报
回复
最好还是看看每个步骤的返回值。 分析下哪个步骤失败。
mirroatl15 2012-11-07
  • 打赏
  • 举报
回复
DockPane调用之后,才可改变工具栏大小//
引用 4 楼 schlafenhamster 的回复:
m_wndImage.Create(32,32,ILC_COLOR32|ILC_MASK,0,0); 为什么2个0,第一个是知道的(2), 第二个一般是 1,表示 备用 1个。
mirroatl15 2012-11-07
  • 打赏
  • 举报
回复
0个 预备0个啊 之前用ctoolbar就行
引用 4 楼 schlafenhamster 的回复:
m_wndImage.Create(32,32,ILC_COLOR32|ILC_MASK,0,0); 为什么2个0,第一个是知道的(2), 第二个一般是 1,表示 备用 1个。
schlafenhamster 2012-11-07
  • 打赏
  • 举报
回复
m_wndImage.Create(32,32,ILC_COLOR32|ILC_MASK,0,0); 为什么2个0,第一个是知道的(2), 第二个一般是 1,表示 备用 1个。
mirroatl15 2012-11-07
  • 打赏
  • 举报
回复

//下面的图形集合对吗?
 m_wndImage.Create(32,32,ILC_COLOR32|ILC_MASK,0,0);     
m_wndImage.Add(AfxGetApp()->LoadIcon(IDI_ICON2));     
m_wndImage.Add(AfxGetApp()->LoadIcon(IDI_ICON3));     m_UserImages.CreateFromImageList(m_wndImage);    
 m_UserImages.SetImageSize(CSize(32,32), TRUE); 
引用 1 楼 schlafenhamster 的回复:
m_wndToolBar.SetUserImage(&m_UserImages); 这是整个集 [in] iImage The image index of the button in the collection of images. 就是整个集里索引。
mirroatl15 2012-11-07
  • 打赏
  • 举报
回复

     // CMFCToolBar       m_wndToolBar;
     // CMFCToolBarImages m_UserImages; 
     // CImageList        m_wndImage;
     //OnCreate函数里的DockPane(&m_wndOutput);加上下面的,怎么出不来图片啊?
	//m_wndProperties.EnableDocking(CBRS_ALIGN_ANY);
	//DockPane(&m_wndProperties);
	//m_wndToolBar.InsertButton(CMFCToolBarButton(ID_FILE_NEW,0,L""));
	m_wndImage.Create(32,32,ILC_COLOR32|ILC_MASK,0,0);
	m_wndImage.Add(AfxGetApp()->LoadIcon(IDI_ICON2));
	m_wndImage.Add(AfxGetApp()->LoadIcon(IDI_ICON3));
	m_UserImages.CreateFromImageList(m_wndImage);
	m_UserImages.SetImageSize(CSize(32,32), TRUE);
	UINT nArray[2] = { ID_MENU1, ID_MENU1};  
	m_wndToolBar.SetButtons(nArray, 2);
	m_wndToolBar.SetSizes(CSize(32,32),CSize(32,32));
	m_wndToolBar.SetUserImages(&m_UserImages);
	m_wndToolBar.SetButtonInfo(0,ID_MENU1,TBBS_CHECKBOX,0);
引用 1 楼 schlafenhamster 的回复:
m_wndToolBar.SetUserImage(&m_UserImages); 这是整个集 [in] iImage The image index of the button in the collection of images. 就是整个集里索引。

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧