I am using AdvGlow(Menu)Buttons within AdvToolBars within AdvPages within a AdvToolbarPager, in order to have a Ribbon-like UI with switchable Styles. This works reasonably well. Now, I wanted to have a changing ImageSize, when the button size state goes from bsLarge to bsLabel, but I can't see how to do it. Below is an image with Screenshots from MS Excel that shows what I want to accomplish.
Using Delphi XE5 and the latest version of TMS components.
The button will stretch the image itself to a smaller size when it changes state.
See the "Tools" tab in the Office2007 demo for TAdvToolBar. A 32x32 picture is assigned and when the button goes to small state, this 32x32 picture shrinks automatically to 16x16
Well, that's right for this Demo project. Even at design time, when the MaxButtonSizeState is changed from bsLarge to bsGlyph and vice versa, the icon is scaled appropiately.
However, this doesn't work for my project. I created the project via File => New => TMS Forms => TMS Office 20106 ribbon application. Now, I just created a fresh project like this, and it behaves the way I describe, without scaling. Supposedly, there is some parameter elsewhere, that has an influence??
Did you set button.AutoSize = true as well as setting button.MaxButtonSizeState = bsLarge and button.MinButtonSizeState = bsGlyph?
Yes, I set the properties like you described, to no avail:-( Problem still unsolved!
I have especially created a new test/sample app.
Of course, your sample app works fine. the only difference I can see: the glyphs in your example come as TPicture into the Picture propertiy.
In my application, there are Imagelists containing all glyphs. However, I now found a better way that actually works:
- assign a 16x16 Imagelist to the Images property of ActionManager
- assign a 32x32 Imagelist to the LargeImages propety of ActionManager
- populate the Imagelists with custom drawn icons (looking better than resizing a 32x32 to 16x16)
- Assign glyphs to Action items via their ImageIndex property (disregarding glyph size)
- assign functionality to AdvGlowButton & AdvMenuButtons with action items via their Action property.
Like this, all the resizing works like a charm...
Thanks anyhow for your effort,
Is possible to do the image resizing if the buttons are linked to a TActionList? I would like not to move all the actions to TActionManager. I have the images in a TVirtualImageList linked to TAdvSvgImageCollection.
If these images must come from a TVirtualImageList, the size will be controlled by the TVirtualImageList.