1

How I can add some image in to Ribbon group (not a button, or some other element)?

There is properties getImage of <group> tag, but it doesn't works. Function 'getimage' is called in my code, but when I am returning some image there is nothing displayed.

Here is code:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
  <ribbon>
    <tabs>
      <tab idMso="TestTab" insertAfterMso="GroupShow" >
        <group id="testGroup" insertAfterMso="GroupShow" centerVertically="true" label="SomeText" getImage="GetImage">
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>
Ted
  • 1,682
  • 3
  • 25
  • 52
  • Does your GetImage work for a button? If it doesn't, show the code for your GetImage function. – Ton Plooij Aug 23 '16 at 09:02
  • GetImage(IRibbonControl control) { switch (control.Id) { case "testGroup": return new Bitmap(Properties.Resources.icon.ToBitmap()); }} – Ted Aug 23 '16 at 09:48
  • It may be related to the color depth and/or resolution of your icon (or icons in the returned bitmap). Groups can require different formats than buttons. – Ton Plooij Aug 23 '16 at 10:11
  • interesting remark, will play with it – Ted Aug 23 '16 at 10:18

1 Answers1

3

According to documentation on the ribbon control "group", it does have attributes "getImage" and "image". Group image will be visible when group is collapsed (group collapsed when not enough space for all the elements of the group; you may achieve it by resizing the window to very narrow) and will be automatically hidden once expanded. You should work with .png images for best result. If you use .ico make sure your icon resource has 16, 32 and 48px images with shallow color depth.

Hope this helps.

Slava Ivanov
  • 6,666
  • 2
  • 23
  • 34