|
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[^]
|
|
|
|
|
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 ?
|
|
|
|
|
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 .
|
|
|
|
|
I guess you're refering to color depth by high quality icons.
Aren't you?
|
|
|
|
|
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 ?
|
|
|
|
|
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.
|
|
|
|
|
Electronic75 wrote: but I have seen many programs that have high quality small toolbars
Yes people author those images. As Mark points out there is no "magic".
|
|
|
|
|
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 .
|
|
|
|
|
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.
<br />
m_barMyOwnToolBar.CreateEx(this, tbstyle-flat, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);<br />
m_barMyOwnToolBar.LoadToolBar(ID_MY_TOOLBAR);<br />
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...
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}
};
...
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_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 something useful from that!
Mark
-- modified at 15:59 Wednesday 27th June, 2007
oops - edits marked in red
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
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)
Yeah....I'm not good at it....I just steal them right out of microsoft exe/dlls
Just kidding Microsoft!
"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!;)
|
|
|
|
|
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."
|
|
|
|
|
Hi all,
I have this sample data in a .txt file,
-- Ne doit pas faire
-- é
select PARC.CONTYP
, PARC.CONSTA
, count(*)
from ParcNonCede PARC
, PLAN P
and PARC.CONSTA not in ('Stock', 'Détourné')
group by CONTYP, CONSTA
;
I am saving this in UTF-8 (not necessarily using Notepad).
Now I have this sample code to detect the Codepage of a buffer as below..
void
ExamineData(String &codepage, String &buffer)
{
IMultiLanguage2 *mlang;
DetectEncodingInfo info = {0};
MIMECPINFO codepageinfo;
int length = 0, cnt = 1;
String codepagestr; // String Datatype is my class
unsigned int len =1;
if(buffer.GetString())
length = buffer.GetLength();
HRESULT hr = S_OK;
SUCCEEDED(CoInitialize(NULL)); // init COM
hr = CoCreateInstance(CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER, IID_IMultiLanguage2,(void **)&mlang);
hr = mlang->DetectInputCodepage(0,0, (wyChar *)buffer.GetString(), &length, &info, &cnt);
if(SUCCEEDED(hr))
{
hr = mlang->GetCodePageInfo(info.nCodePage, info.nLangID, &codepageinfo);
if(SUCCEEDED(hr))
codepage.SetAs(codepageinfo.wszDescription);
}
mlang->Release();
CoUninitialize();
}
Now this Function Detects the Codepage for the Buffer as "Western European (Windows)" even though it is an UTF-8. But Notepad is able to correctly detect it as UTF-8.
I am Not able to come to a conclusion whether it is a problem with the code or with the API.
Please Help me.
Thanks in Advance,
Manohar.S
|
|
|
|
|
anybody?
I need some help over here..
Regards
Manohar.S
|
|
|
|
|
There has a Client connected with the Server.
How should the Server could test the Client's net-speed?
GOOD LUCK
|
|
|
|
|
kcynic wrote: How should the Server could test the Client's net-speed?
I dont know a reliable method. However, monitor the maximum transfer rate or let the user on the client end enter his connection speed (client needs to communicate that to the server). In any case the average network transfer rate depends on many factors and won't be a fixed value over time.
kcynic wrote: GOOD LUCK
?
|
|
|
|
|
I have a project complied using shared dll of MFC.I should release it now.
How but the .exe could not run on other PC with no VC.
I know I should release all the .dll files with the .exe file.But how should I find witch .dll files I should copy it?
Thanks
|
|
|
|
|
Run the Microsoft Tools->Dependency walker and put the dll in it. It will show all dependency.
|
|
|
|
|
I find there has no such tool in VS2005. I use vc6's Dependency Walker to view the dll it need.I add all the dlls.
But when I make a install project and using the result setup file to install it in another PC,it could not run but terminated with the message that the configuration is wrong.
How to resolve it?
Thanks
|
|
|
|
|