I'm building menus in code. I need to be able to set the menu item image, but the only way I see to do this is by providing a URL string.
The problem is that the images are embedded resources, not separate files on the file system. So I would like to be able to do something like...
Obviously that won't work. Is there a way to do this by providing the image data directly rather than a URL to a file?
The problem is that the images are embedded resources, not separate files on the file system. So I would like to be able to do something like...
Assembly assembly = Assembly.GetExecutingAssembly();
Stream imageStream = assembly.GetManifestResourceStream(ResourceName);
menuItem.ImageUrl(or other property) =
new
Bitmap(imageStream);
Obviously that won't work. Is there a way to do this by providing the image data directly rather than a URL to a file?