small but high quality(color depth and pixel) toolbar? [modified]
-
Hello, I'm programming in MFC and with visual studio 2005. I want to have a small toolar in my application(size of standard 16x16) toolbars. I have very nice but bigger icons that I like to place in my small toolbar but I can't. either I have to use bigger toolbars(size of standard 32x32) or I have to skew my nice icons. Can I use bigger icons(bigger than 16x16) in my small(16x16) toolbar? what is the limit? thanks alot. -- modified at 10:40 Wednesday 27th June, 2007
-
Hello, I'm programming in MFC and with visual studio 2005. I want to have a small toolar in my application(size of standard 16x16) toolbars. I have very nice but bigger icons that I like to place in my small toolbar but I can't. either I have to use bigger toolbars(size of standard 32x32) or I have to skew my nice icons. Can I use bigger icons(bigger than 16x16) in my small(16x16) toolbar? what is the limit? thanks alot. -- modified at 10:40 Wednesday 27th June, 2007
It's not simpler to convert your icons to 16x16? I use the free IconoMaker[^]
Network integrated solutions A practical use of the MVC pattern
-
It's not simpler to convert your icons to 16x16? I use the free IconoMaker[^]
Network integrated solutions A practical use of the MVC pattern
Hello zoltan, I can convert icons to 16x16 but quality of downsized icons will be lost. I would like to see high quality but small icons. am I asking too much:rolleyes:?
-
Hello zoltan, I can convert icons to 16x16 but quality of downsized icons will be lost. I would like to see high quality but small icons. am I asking too much:rolleyes:?
Electronic75 wrote:
I would like to see high quality but small icons.
Yes, that's asking too much. There's no way to magically squeeze larger icons/bitmaps down to 16x16 without some kind of pixel loss :) Mark
"Go that way, really fast. If something gets in your way, turn."
-
Electronic75 wrote:
I would like to see high quality but small icons.
Yes, that's asking too much. There's no way to magically squeeze larger icons/bitmaps down to 16x16 without some kind of pixel loss :) Mark
"Go that way, really fast. If something gets in your way, turn."
Hello mark, but I have seen many programs that have high quality small toolbars, I'm sure you have seen them too. they can't be 16x16, for example MS WORD or MS EXCEL,... there should be a way. of course if there are more than one way, I prefer shorter way :).
-
Hello mark, but I have seen many programs that have high quality small toolbars, I'm sure you have seen them too. they can't be 16x16, for example MS WORD or MS EXCEL,... there should be a way. of course if there are more than one way, I prefer shorter way :).
I guess you're refering to color depth by high quality icons. Aren't you? :confused:
Network integrated solutions A practical use of the MVC pattern
-
I guess you're refering to color depth by high quality icons. Aren't you? :confused:
Network integrated solutions A practical use of the MVC pattern
yes zoltan, color depth is one important quality factor another is number of pixels, for example I have extremely beautiful icons that are about 32000 bytes, yes icons with .ico format and size of 32k they are looking extremely nice but they are 32x32. of course I have also icons that are 32x32 and just 766 bytes, they are also good(but definately not as good as 32K icons), so color depth is important but also number of pixels is important. if you look at icons in small toolbars of programs like ms-excel and ms-word, it is not just their color depth but also their pixels(resolution), I don't think one can find small icons like ms-word& ms-excel at 16x16 resolution no matter of color depth. My problem in another way of expressing it is Visual studio 2005 dose not let me to use 32x32 icons for small toolbars, so if I use 32x32 icons in my toolbar it will be at 32x32 size(much bigger). another limitation of visual studio is it dose not allow color resolution more than 8 bit for toolbar icons no matter of size. any solution:confused:?
-
yes zoltan, color depth is one important quality factor another is number of pixels, for example I have extremely beautiful icons that are about 32000 bytes, yes icons with .ico format and size of 32k they are looking extremely nice but they are 32x32. of course I have also icons that are 32x32 and just 766 bytes, they are also good(but definately not as good as 32K icons), so color depth is important but also number of pixels is important. if you look at icons in small toolbars of programs like ms-excel and ms-word, it is not just their color depth but also their pixels(resolution), I don't think one can find small icons like ms-word& ms-excel at 16x16 resolution no matter of color depth. My problem in another way of expressing it is Visual studio 2005 dose not let me to use 32x32 icons for small toolbars, so if I use 32x32 icons in my toolbar it will be at 32x32 size(much bigger). another limitation of visual studio is it dose not allow color resolution more than 8 bit for toolbar icons no matter of size. any solution:confused:?
Well I did try to convert a 32x32 icon to 16x16 with iconomaker. After the convert the 16x16 icon looked just as great as the 32x32. So yes I think this is a solution. Resize your icons. It will lose some pixels but at 16x16 size you won't observe.
Network integrated solutions A practical use of the MVC pattern
-
Hello mark, but I have seen many programs that have high quality small toolbars, I'm sure you have seen them too. they can't be 16x16, for example MS WORD or MS EXCEL,... there should be a way. of course if there are more than one way, I prefer shorter way :).
-
Hello mark, but I have seen many programs that have high quality small toolbars, I'm sure you have seen them too. they can't be 16x16, for example MS WORD or MS EXCEL,... there should be a way. of course if there are more than one way, I prefer shorter way :).
Yes, what led mike and Zoltan stated :) It's going to depend on the quality of your resizing. For example, Photoshop will do a good job using interpolation, compared to letting Windows resize them, which may just remove pixels, resulting in poorer quality. Take a look at the resources in the Microsoft apps...they generally have many sizes authored for the same icons. The advantage of having a good art department :) Mark
"Go that way, really fast. If something gets in your way, turn."
-
Yes, what led mike and Zoltan stated :) It's going to depend on the quality of your resizing. For example, Photoshop will do a good job using interpolation, compared to letting Windows resize them, which may just remove pixels, resulting in poorer quality. Take a look at the resources in the Microsoft apps...they generally have many sizes authored for the same icons. The advantage of having a good art department :) Mark
"Go that way, really fast. If something gets in your way, turn."
Mark, led mike and Zoltan, I tried Icon maker and also photoshop(differnt filters) but believe me result was catastrophic! It was much nicer if me who can't draw much nicer than a 5 years old, draw it from scratch! I'm not looking for a magic spell but some programming tricks so I can give 32x32 icons to CToolbar and CToolbar draw them at size of 16x16 toolbars. I still can't believe nice small icons in visual studio and MS office are really 16x16:omg:.
-
Mark, led mike and Zoltan, I tried Icon maker and also photoshop(differnt filters) but believe me result was catastrophic! It was much nicer if me who can't draw much nicer than a 5 years old, draw it from scratch! I'm not looking for a magic spell but some programming tricks so I can give 32x32 icons to CToolbar and CToolbar draw them at size of 16x16 toolbars. I still can't believe nice small icons in visual studio and MS office are really 16x16:omg:.
16x16 is 256 pixels - there's no way around it :) Some questions(so maybe we can come up with an acceptable solution): What is the format of your source "icons"... Bitmap or Icon? How many bits-per-pixel? Do they contain a transparent color or use alpha values? How are you setting the button bitmaps in the toolbar? Can you provide a code sample? Are you using TB_ADDBITMAP or an imagelist? Mark
"Go that way, really fast. If something gets in your way, turn."
-
16x16 is 256 pixels - there's no way around it :) Some questions(so maybe we can come up with an acceptable solution): What is the format of your source "icons"... Bitmap or Icon? How many bits-per-pixel? Do they contain a transparent color or use alpha values? How are you setting the button bitmaps in the toolbar? Can you provide a code sample? Are you using TB_ADDBITMAP or an imagelist? Mark
"Go that way, really fast. If something gets in your way, turn."
Nice icons all in .ico format and high color for those that are really big (>30KB) and 8bit color(256color) those that are 766 bytes. for the moment lets forget high color, so we are talking about 256 color 32x32 .ico format that most of them do not have transparent colors. The way I use them is pretty much straight forward,in visual studio 2005 in Resource view under toolbar node, I add a toolbar then I copy the icon of button that I've already opened as icon resource and paste it over the button. The toolbar has an ID for example ID_MY_TOOLBAR. then I define a CToolbar member variable in CMainFrame and in OnCreate function I create my toolbar.
m_barMyOwnToolBar.CreateEx(this, tbstyle-flat, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_barMyOwnToolBar.LoadToolBar(ID_MY_TOOLBAR);
now if my original icons in toolbar are large 32x32 then toolbar will be large and if my original icon are 16x16 then my toolbar will be at right size. the problem is I want to load 32x32 but I want 16x16 size. still am I asking too much?:) -
Nice icons all in .ico format and high color for those that are really big (>30KB) and 8bit color(256color) those that are 766 bytes. for the moment lets forget high color, so we are talking about 256 color 32x32 .ico format that most of them do not have transparent colors. The way I use them is pretty much straight forward,in visual studio 2005 in Resource view under toolbar node, I add a toolbar then I copy the icon of button that I've already opened as icon resource and paste it over the button. The toolbar has an ID for example ID_MY_TOOLBAR. then I define a CToolbar member variable in CMainFrame and in OnCreate function I create my toolbar.
m_barMyOwnToolBar.CreateEx(this, tbstyle-flat, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_barMyOwnToolBar.LoadToolBar(ID_MY_TOOLBAR);
now if my original icons in toolbar are large 32x32 then toolbar will be large and if my original icon are 16x16 then my toolbar will be at right size. the problem is I want to load 32x32 but I want 16x16 size. still am I asking too much?:)I personally have a problem with the LoadToolBar() method of constructing a toolbar - it alters the color table of the bitmap. It works great for 16-color bitmaps and RAD but I like control over my code :). For best results, I prefer to use an image list - it lets you specify a transparent color and supports 24-bit RGB bitmaps nicely. It takes a few extra steps, but the reward is complete control over your button bitmaps...
// In this example, I'm creating a toolbar with 2 buttons. Each button bitmap is 16x16,
//32-bit ARGB 24-bit RGB
. The transparent color is bright green...// In the parent window's .CPP file
static TBBUTTON ToolBarButtonDescs[] =
{
{0, ID_BUTTON1, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0,0}, 0, 0},
{1, ID_BUTTON2, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0,0}, 0, 0}
};
...
// In the parent window's constructor (m_ToolBarImageList is member variable CImageList m_ToolBarImageList; )
// IDB_TOOLBARBITMAP is the ID of the bitmap resource to load into an image list
CBitmap bitmap;
bitmap.LoadBitmap(IDB_TOOLBARBITMAP);
m_ToolBarImageList.Create(16, 16, ILC_COLOR24|ILC_MASK, 2, 1);
m_ToolBarImageList.Add(&bitmap, RGB(0x00,0xFF,0x00));
...
// In the parent window's OnCreate()/OnInitDialog()
m_barMyOwnToolBar.CreateEx(this, TBSTYLE_FLAT,
WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY |
CBRS_SIZE_DYNAMIC);
m_barMyOwnToolBar.GetToolBarCtrl().SetImageList(&m_ToolBarImageList);
m_barMyOwnToolBar.GetToolBarCtrl().AddButtons(2, ToolBarButtonDescs);Note that you need to create the bitmap for the imagelist. It needs to be 16 pixels high by (16 * numberofbitmaps) pixels wide. Create this bitmap with a good bitmap editor as mentioned before - your buttons will look like whatever you make the bitmap look like (unlike when you use LoadToolBar()). Also note that this works for me....I'm not saying it's the best method - it's just one example. I find it very flexible at the expense of a few extra ines of code. You don't have to use a
24-bit RGB
bitmap for the imagelist. If you choose to use 256-color, create it something like: //CBitmap bitmap; //bitmap.LoadBitmap(IDB_TOOLBARBITMAP); //m_ToolBarImageList.Create(16, 16, ILC_COLOR24|ILC_MASK, 2, 1); //m_ToolBarImageList.Add(&bitmap, RGB(0x00,0xFF,0x00)); m_ToolBarImageList.Create(IDB_TOOLBARBITMAP, 16, 1, RGB(0x00,0xFF,0x00)); Hope you can extract som -
I personally have a problem with the LoadToolBar() method of constructing a toolbar - it alters the color table of the bitmap. It works great for 16-color bitmaps and RAD but I like control over my code :). For best results, I prefer to use an image list - it lets you specify a transparent color and supports 24-bit RGB bitmaps nicely. It takes a few extra steps, but the reward is complete control over your button bitmaps...
// In this example, I'm creating a toolbar with 2 buttons. Each button bitmap is 16x16,
//32-bit ARGB 24-bit RGB
. The transparent color is bright green...// In the parent window's .CPP file
static TBBUTTON ToolBarButtonDescs[] =
{
{0, ID_BUTTON1, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0,0}, 0, 0},
{1, ID_BUTTON2, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0,0}, 0, 0}
};
...
// In the parent window's constructor (m_ToolBarImageList is member variable CImageList m_ToolBarImageList; )
// IDB_TOOLBARBITMAP is the ID of the bitmap resource to load into an image list
CBitmap bitmap;
bitmap.LoadBitmap(IDB_TOOLBARBITMAP);
m_ToolBarImageList.Create(16, 16, ILC_COLOR24|ILC_MASK, 2, 1);
m_ToolBarImageList.Add(&bitmap, RGB(0x00,0xFF,0x00));
...
// In the parent window's OnCreate()/OnInitDialog()
m_barMyOwnToolBar.CreateEx(this, TBSTYLE_FLAT,
WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY |
CBRS_SIZE_DYNAMIC);
m_barMyOwnToolBar.GetToolBarCtrl().SetImageList(&m_ToolBarImageList);
m_barMyOwnToolBar.GetToolBarCtrl().AddButtons(2, ToolBarButtonDescs);Note that you need to create the bitmap for the imagelist. It needs to be 16 pixels high by (16 * numberofbitmaps) pixels wide. Create this bitmap with a good bitmap editor as mentioned before - your buttons will look like whatever you make the bitmap look like (unlike when you use LoadToolBar()). Also note that this works for me....I'm not saying it's the best method - it's just one example. I find it very flexible at the expense of a few extra ines of code. You don't have to use a
24-bit RGB
bitmap for the imagelist. If you choose to use 256-color, create it something like: //CBitmap bitmap; //bitmap.LoadBitmap(IDB_TOOLBARBITMAP); //m_ToolBarImageList.Create(16, 16, ILC_COLOR24|ILC_MASK, 2, 1); //m_ToolBarImageList.Add(&bitmap, RGB(0x00,0xFF,0x00)); m_ToolBarImageList.Create(IDB_TOOLBARBITMAP, 16, 1, RGB(0x00,0xFF,0x00)); Hope you can extract somThanks Mark, Though original problem persists but your way of attaching bitmaps difinately is better than mine, thanks. I have to solve this issue one way or another either programistic way(accomodate 32x32 bit icons in 16x16 place) or artistic way(work on my drawing skills to draw 16x16 icons that look really good).:)
-
Thanks Mark, Though original problem persists but your way of attaching bitmaps difinately is better than mine, thanks. I have to solve this issue one way or another either programistic way(accomodate 32x32 bit icons in 16x16 place) or artistic way(work on my drawing skills to draw 16x16 icons that look really good).:)
Electronic75 wrote:
work on my drawing skills to draw 16x16 icons that look really good)
:laugh: Yeah....I'm not good at it....I just steal them right out of microsoft exe/dlls ;) Just kidding Microsoft! ;P
"Go that way, really fast. If something gets in your way, turn."
-
Electronic75 wrote:
work on my drawing skills to draw 16x16 icons that look really good)
:laugh: Yeah....I'm not good at it....I just steal them right out of microsoft exe/dlls ;) Just kidding Microsoft! ;P
"Go that way, really fast. If something gets in your way, turn."
Mark Salsbery wrote:
I just steal them right out of microsoft exe/dlls
Don't ever look at the issue this way! every program that you write for MS-Windows platform causes many users of that program are being forced to use MS-Windows, so in fact you are a microsoft employee working for free for them. if something is being stealed it is from the other side!;)
-
Mark Salsbery wrote:
I just steal them right out of microsoft exe/dlls
Don't ever look at the issue this way! every program that you write for MS-Windows platform causes many users of that program are being forced to use MS-Windows, so in fact you are a microsoft employee working for free for them. if something is being stealed it is from the other side!;)
Of course! That was just my public comments about the subject ;) *edit* Oh, and if anybody asks, I was never here...
"Go that way, really fast. If something gets in your way, turn."