Although the number of built-in images in Excel is large we still may want to use custom images. Because it exist a great number of inexpensive commercial images packages it is not justified to spend our time to create customized images.
So the question is which image format to use? The Ribbon drawing engine is designed to work best with full-color (24-bit) images that also have an alpha channel to control each pixel’s transparency. Since the PNG file format supports an alpha channel and produces relatively small files, it is the best alternative. The preferred sizes of custom images are either 16×16 (small size) or 32×32 (large size).
The first step is to add the selected images to a project’s resources and then create the code to use them. Adding images to the resources is not an issue and the first figure shows the added images for the case.
The next screen shot shows the content of the Ribbon.xml file which is also added to the resources of the project:
The following screen shot shows the class Ribbon.vb:
The key to the solution is the function GetImage which uses the System.Drawing namespace to return Bitmap objects.
The next screen shot shows ThisAddin class of the VSTO Add-in I use for the case:
When running the above code the customized Ribbon UI solutions looks like the following:
Looking on the solution it reveals nothing extraordinary in order to use custom images in Ribbon UI solutions.
(If we only have access to images in the GIF or BMP or JPEG file format then we can apply the same approach as with the PNG images.)