24 Posts
0 Kudos
Registered: ‎05-19-2011
Post 1 of 3

Not able to display my .png files in the ribbon

277 Views, 2 Replies
12-23-2012 07:30 PM

Hello all,

Good day,  Merry Christmas and a Happy new year to all,

I am trying to create a ribbon of my own, and the code and execution is fine, but I am not able to put the images.

my images are not more than 1 kb in size and are stored in the resources.resources1.... how do I get them to display.
Please help.

I am trying to work with the available code found in one of the training sessions,

'Code starts

'on one of my subs I am calling this function 

'ribBtn.LargeImage = LoadImage("FR.png")

Private Shared Function LoadImage(ByRef ImageName As String) As Imaging.BitmapImage

Dim bi As New System.Windows.Media.Imaging.BitmapImage()

bi.StreamSource = GetEmbeddedResourceStream("MyRibbon_Autocad." & ImageName)
bi.EndInit() ' When i debug the code, the code is exiting at this point, i am assuming it is not getting initialised.
Return bi
End Function

Protected Shared Function GetEmbeddedResourceStream(ByVal ResourceName As String) As Stream
Return System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(ResourceName)
End Function


I dont see any error, but the ribbon is getting generated but withut any images, just a plane ribbon.


ADN Support Specialist
762 Posts
100 Kudos
Registered: ‎03-21-2011
Post 2 of 3

Re: Not able to display my .png files in the ribbon

01-01-2013 10:06 PM in reply to: jamkhp



Wish you a very happy new year.


Have you set the "ribBtn.Size = RibbonItemSize.Large" ?

This will ensure that AutoCAD uses the large image.


Here is a blog post with a sample code that might help :


Developer Technical Services
Autodesk Developer Network

21 Posts
1 Kudo
Registered: ‎08-20-2008
Post 3 of 3

Re: Not able to display my .png files in the ribbon

01-02-2013 05:39 PM in reply to: jamkhp


Thank you and to you

using System.Windows.Media.Imaging;
using Autodesk.Windows;

RibbonButton rConductorbutton = new RibbonButton();
            rConductorbutton.Text = "OOO";
            rConductorbutton.Id = "btnConductor";
            rConductorbutton.Orientation = System.Windows.Controls.Orientation.Vertical;
            rConductorbutton.Size = RibbonItemSize.Standard;
            rConductorbutton.Image = new BitmapImage(new Uri(... + @"\Icon\Conductor32.png", UriKind.RelativeOrAbsolute));
            rConductorbutton.ShowText = true;
            rConductorbutton.ShowImage = true;
            rConductorbutton.Click += new System.Windows.RoutedEventHandler(btnCounductor_Click);



it can be one of the ways that you can use to show png file but it's C# if couldn't change it to VB let me know to change it for you


Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!