The image sizes increase in a linear fashion relative to dpi as illustrated in the following table.
DPI |
Small Image |
Large Image |
96 dpi |
16x16 pixels |
32x32 pixels |
120 dpi |
20x20 pixels |
40x40 pixels |
144 dpi |
24x24 pixels |
48x48 pixels |
192 dpi |
32x32 pixels |
64x64 pixels |
You can use *.ico file format where you can embed different image sizes. Office applications will pick up an image from the *.ico file which suits the current scale factor best.
Also BMP and PNG file formats are supported by the Fluent UI. You may consider implementing the getImage
callback where you can return an image according to the scaling factor set per monitor.
The callback should have the following signature:
C#: IPictureDisp GetImage(IRibbonControl control)
VBA: Sub GetImage(control As IRibbonControl, ByRef image)
C++: HRESULT GetImage([in] IRibbonControl *pControl, [out, retval] IPictureDisp ** ppdispImage)
Visual Basic: Function GetImage(control as IRibbonControl) as IPictureDisp
Note, it is your responsibility to react on scaling factor changes and update images. For each of the callbacks that the add-in implements, the responses are cached.
For example, if an add-in writer implements the getImage
callback procedure for a button, the function is called once, the image loads, and then if the image needs to be updated, the cached image is used instead of recalling the procedure. This process remains in place until the add-in signals that the cached values are invalid by using the Invalidate
method, at which time, the callback procedure is again called and the return response is cached. The add-in can then force an immediate update of the UI by calling the Refresh
method.