Professional UI Solutions
Site Map   /  Register
 
 

Forum

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 General Discussion » Variable CExtToolBoxWnd icon size Collapse All
Subject Author Date
Roger Taplin Mar 4, 2006 - 5:02 PM

I have a toolbox with just two folders.

I want to use 32 x 32 sized icons for folder A and 16 x 16 icons for folder B, with item heights adjusted correspondingly.

Overriding OnToolBoxWndMasureItem() successfully changes the item heights but all icons are forced to the height of the largest icon (32 x 32), irrespective.

Is there a simple way to set the height of an item to the size of its icon?

Technical Support Mar 6, 2006 - 7:16 AM

The toolbox was designed to be similar to that you can find in Visual Studio .NET and Visual Studio 2005. We have hard coded the item size calculation in it according to the design idea of the toolbox control. Unfortunately its items do not allow to specify a custom size and you really need to override the OnToolBoxWndMasureItem() virtual method. To simplify this method you can use some map with key values corresponding to toolbox items and mapped values which describe the custom size of the toolbox item. This map should be initialized within all the toolbox items.

Roger Taplin Mar 6, 2006 - 3:31 PM

Thanks for your reply.

I’ve already successfully varied item height using an override to OnToolBoxWndMasureItem(). This works well. I have items in folder A drawn with a 32 pixel height and items in folder B drawn with a much smaller height (20 pixels).

My problem is that the folder B item icons are drawn as 32 x 32 pixels even though they are 16 x 16 icons. The enlarged icons spill over the top and bottom of each 20 pixel item.

Technical Support Mar 7, 2006 - 10:32 AM

Toolbox items are painted by the CExtToolBoxWnd::OnToolBoxWndDrawItem() virtual method. You can use step-by-step debugging and check icon sizes. This will help you to find out whether you have assigned correct icons to toolbox items. Please note the LoadIcon() API always loads only 32x32 icons. To load icons of another size, use the LoadImage() API instead.