1

I have created some (CMFCToolBar) toolbars and added buttons and icons to them. I read on Microsoft's official website that CMFCToolBar takes 23x22 button size and 16x15 icon size (ref: link).

If I use 16x15 for the icons, then icons appear blurry. This is because the icons are originally with size 16x16. I used the function SetSizes(CSize (23,23), CSize(16,16)) to change icon size but the icons do not appear right:

image

Is there another way to set icon and button size?


Update

I called the SetSize function before create toolbar but the icon still appear a little blurry:

Image

I want to know if there is a way to set Icon/button Transparent or make it clear like we can set toolbar transparent through TBSTYLE_TRANSPARENT in CreateEx function.

Community
  • 1
  • 1
Fatima A.
  • 41
  • 13

1 Answers1

2

SetSizes is a static function that affects the complete library.

It should be called before you create any toolbar or menu object. Best location is in InitInstance of you applicxation.

But my tipp: Use the sizes that are recommended! 16x15 and 23x22....

Transparency can be done with standard 32bit RGB/A bitmaps. If you have a 16 color bitmap you should use RGB(192,192,192) as the standard color for the background. It is automatically replaced with the needed background color.

This has been answered here too.

xMRi
  • 14,982
  • 3
  • 26
  • 59
  • I have called SetSizes Function before create and but now the icon appear a little blur. I am editing my question. Kindly, Check for details – Fatima A. Sep 10 '18 at 10:27
  • This is a different aspect. But i changed my answer. – xMRi Sep 10 '18 at 12:02
  • Please note that in SO you should always open a new question if the new topic you want to ask covers a different aspect like in this case. The question about transparency has nothing to do with your primary question! If you don't care about such rules, your question may get down voted or may be put on hold... – xMRi Sep 10 '18 at 13:05
  • Okay, Thanks. Will not do that again. – Fatima A. Sep 11 '18 at 05:17
  • Related to the transparency issue I want to mention that I have .ico Icons and not bitmap. In the question I added the picture where icon appears blur/ unclear. How can I do that? – Fatima A. Sep 11 '18 at 07:19
  • @Fatema: To prevent visual artifacts, don't scale images. Besides, .ico is a container format. It can contain different types of icons, including PNG encoded icons with per-pixel alpha transparency. Also, .ico files can store one or more images. Just add images with the size(s) you plan to use. – IInspectable Sep 11 '18 at 08:04