Hello,
I trying to find the correct way to have the image backgrounds not stand out when they are used in the ribbon or tool bar.
For example, in AutoCAD's Insert ribbon the button's Attach and Auto Update the ribbon and button image background colours appear to be the same and when the mouse pointer is hovered over them, the background remains the same
I've defined some images, some with a grey background and some with a white background. The next three images show them in use in buttons in the ribbon. The grey background can be seen but not the white. However the white appears when the mouse is hovered over it.
When used in a tool bar the grey background is not visible but the white is.
What do I need to do to define images so that I get the background behaving as it does for the AutoCAD Attach button and also not have backgrounds visible in toolbars?
Cheers
Craig
Hi
Thanks for your replies. I haven't tried ICO or PNG yet because I have a large number of bitmaps that I hope to be able to use for both tool bars and ribbon buttons.
The 192,192,192 background in the bitmap works through CUI. I changed the White BG image to use the new background and this is how it appears in the tool bar , ribbon buton and when mouse hovered over ribbon button .
All the bmp files are in my project's resource file. When I try to programatically build the ribbon the result is not as expected i.e. the background is visible e.g.
Here's an extract of the code
// ... Bitmap img16 = new Bitmap; img16 = Resources.MyImage16; // ... RibbonButton rb = new RibbonButton(); rb.Image = GetBitmap(img16); // ... } private BitmapImage GetBitmap(Bitmap image) { MemoryStream stream = new MemoryStream(); image.Save(stream,ImageFormat.Png); BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); bmp.StreamSource = stream; bmp.EndInit(); return bmp; }
What do you think?
Craig
I've created a corresponding set of icons with transparent backgrounds and I am now using them as the images for the ribbon buttons. The backgrounds are no longer visible.
It would be nice to understand why the bitmap route is not working.
Craig
Hello Craig,
I haven't tried your code but I think the bitmap does not have its transparent color set.
So, can you please try this ?
bmp.MakeTransparent(System.Drawing.Color.FromArgb(192, 192, 192));
Regards,
Balaji
Hi Balaji,
The result of calling MakeTransparent made the background appear black.
Regards
Craig
Hello Craig,
Sorry for the delay. I got involved in another task that came up.
I have attached a sample code that works ok. The image appeared transparent in a ribbon button.
Regards,
Balaji
天ę¶Æęµ·č§ēå±±å§
ęØ认äøŗę¤åøåęÆå¦ęēØļ¼ę¬¢čæäøŗę¤åøē¹čµć
ęØēé®é¢ęÆå¦å·²å¾å°č§£ēļ¼čÆ·ē¹å»āę„åč§£ēāęé®ć
Hi,
Tough to suggest what is happening at your end from the information provided. Can you provide non-confidential simple sample which demonstrates the behavior?