15,979
社区成员
发帖
与我相关
我的任务
分享
//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.
//下面的图形集合对吗?
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);
// 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);