Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtToolControlBar and menu Collapse All
Subject Author Date
Borremans Pierre Oct 28, 2009 - 2:13 AM

I want to have in my menu icones with a size of 16*16 and in my Cextoolcontrolbar icones with a size of 32*32. The ressource ID in my menu and in my cextoolcontrolbar must be the same. Is there any solution

Borremans Pierre Nov 18, 2009 - 4:13 AM

Thanks for your help, I found a solution. I overdrive the CalculateLayout and PaintCompound from the CExtBarButton class and It works.

Technical Support Nov 10, 2009 - 2:33 PM

1) Use DestroyIcon() Win32 API for destroying HICON handles. Invoking the DeleteObject() instead of it can even crash Windows.

2) Add the CExtCmdIcon m_icon; property to your toolbar button class and return a pointer it from the GetIconPtr() method.

Technical Support Oct 28, 2009 - 9:44 AM

Prof-UIS supports only one icon for each one command identifier. So, it’s much easier to use different identifiers for menu items and toolbar buttons because you can simply add two message map entries for menu command / toolbar button and connect them to one handler method.
But it’s also possible to use the same command identifiers for menu items and toolbar buttons and provide toolbar buttons with a bigger images at a same time. You can use your own CExtToolControlBar-derived class which implements the CExtToolControlBar::OnCreateBarCommandBtn() virtual method. Your virtual method should be similar to original, but it should instantiate You can use your own CExtBarButton-derived class. As result your application will use your toolbar class and each toolbar will contains buttons of your toolbar button class type. This CExtBarButton-derived class should implement CExtBarButton::GetIconPtr() virtual method for providing toolbar buttons with custom icons.

Borremans Pierre Nov 10, 2009 - 7:59 AM

I try this but the icon in my mainframe menu change to 32*3. Where is my error ?


class CUI_ToolBar :
	public CExtToolControlBar
	class CMyButtonToolBar : public CExtBarButton
			CExtToolControlBar * pBar, // = NULL
			UINT nStyle // = 0
		): CExtBarButton(pBar, nCmdID, nStyle)
		virtual CExtCmdIcon * GetIconPtr()
			CExtCmdIcon* pTmpIcon = __super::GetIconPtr(); 
				HICON hSomeNewIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(501), IMAGE_ICON, 32,32,0);
				pTmpIcon->AssignFromHICON(hSomeNewIcon, true, false);

			return pTmpIcon;

	virtual CExtBarButton * OnCreateBarCommandBtn(UINT nCmdID, UINT nStyle = 0)
		ASSERT_VALID( this );
		CExtBarButton  * pTBB = new CMyButtonToolBar( this, nCmdID, nStyle );
		return pTBB;