custom size of buttons

Add-in Express™ Support Service
That's what is more important than anything else

custom size of buttons
how to change size of a button on a ribbon to fit the size of a picture 
tom rozek




Posts: 14
Joined: 2011-03-03
hey,

I'd like to set an image to a picture but it's size is about 75x30 and when i set it as a button image it's shrunk to 16x16 i guess. Is there any way to set size of whole button or just the picture to whatever dimensions i want?

regards,
Tom
Posted 21 Mar, 2011 04:41:07 Top
Dmitry Kostochko


Add-in Express team


Posts: 2731
Joined: 2004-04-05
Hi Tom,

Images on ribbon buttons can be only 16x16 or 32x32.
Posted 21 Mar, 2011 06:46:30 Top
tom rozek




Posts: 14
Joined: 2011-03-03
;/
is there a way to use windows.forms.button as a part of a ribbon?
any ideas how to add a custom size button and image to ribbon?

and what about CommandBarButtons, it is possible to set height and width for them but how to stretch the image to fit the button size?
Posted 21 Mar, 2011 06:58:39 Top
Dmitry Kostochko


Add-in Express team


Posts: 2731
Joined: 2004-04-05
Hi Tom,

Images for all ribbon buttons have fixed sizes, this is the Microsoft Office ribbon's limitation. Command bar buttons also have such limitations, their image size is limited to 16x16. It is impossible to embed a .NET control into the ribbon either. Sorry, but it looks like your task is not feasible, at least in Office 2007 applications.

But in Office 2010 applications you can use their Backstage View, it supports adding images of various sizes.
Posted 21 Mar, 2011 11:02:35 Top
tom rozek




Posts: 14
Joined: 2011-03-03
hi Dimirty,

In older Outlooks i used advanced controls and bound them with windows.forms.buttons that allowed me to set their sizes and images as i wanted it. But unfortunately i couldn't find anything like that for ribbons. in offices 2007 i use commandbars so it works for me too.

How to change images of my advanced buttons OnMouseOver? I tested it and the event fires up but changing the image doesn't work. Maybe i should refresh the button, i try this and it doesn't work for me:

 Private Sub Button_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles abtnButton.MouseEnter

        Me.abtnButton.Image = Global.Plugin.My.Resources.buttonOvr
        Me.ACAdapter.UpdateControlObj(Me)
        Me.abtnButton.Refresh()
        

what do i do wrong?

and how to handle the same event for ADXRibbonButton ?
Posted 22 Mar, 2011 02:33:56 Top
Dmitry Kostochko


Add-in Express team


Posts: 2731
Joined: 2004-04-05
Hi Tom,

You can get access to an embedded instance of your Windows.Forms.Button by using the ActiveInstance property of the ADXCommandBarAdvancedControl class.

and how to handle the same event for ADXRibbonButton ?


A ribbon button does not have an event like MouseEnter.
Posted 22 Mar, 2011 10:29:13 Top