15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Is this a bug in CToolBarCtrl?

Jean Tu -- tu@cig.mot.com
Monday, March 17, 1997

Environment: VC++ 4.2-flat, NT 3.51

I am using a CToolBarCtrl in a dialog box. Bitmaps are created using the
resource editor. All the color seems to be fine in the resource editor,
but at run time some of the color won't get displayed properly. For
instance, I use Magenta and Blue in the bitmap, at run time I got white
and green (RGB(0, 128, 0)) respectively. I thought may be my palette is
somehow changed, so I used above colors in a splash window (also a
bitmap)and all the colors are displayed fine.

I don't know if this is a bug in CToolBarCtrl or simply that I did
something wrong. Can someone help me?


Thanks,
Jean

-- 
Jean Tu			Motorola Celluar Infrastructure Group
Software Engineer	World Wide System Test Tools
(847) 632-2708		1501 W. Shure Drive     
tu@cig.mot.com		Arlington Heights, IL 60004



Helmut Muelner -- hmuelner@iicm.tu-graz.ac.at
Friday, March 21, 1997


Environment: VC++ 4.2-flat, NT 3.51

Jean Tu writes:
 >=20
 > I am using a CToolBarCtrl in a dialog box. Bitmaps are created using=
 the
 > resource editor. All the color seems to be fine in the resource edit=
or,
 > but at run time some of the color won't get displayed properly. For
 > instance, I use Magenta and Blue in the bitmap, at run time I got wh=
ite
 > and green (RGB(0, 128, 0)) respectively. I thought may be my palette=
 is
 > somehow changed, so I used above colors in a splash window (also a
 > bitmap)and all the colors are displayed fine.
 >=20
 > I don't know if this is a bug in CToolBarCtrl or simply that I did
 > something wrong. Can someone help me?

I also had this problem. After many hours of debugging, searching and
head scratching I found out that this is not a bug but a feature,
documented only in a MSDN-article (date Dec 31, 1992!):

>Each icon on the strip is a 16-color bitmap that shows how the button =
face appears in its normal s
>tate, that is, when the button is enabled and is not pressed. The tool=
bar draws the other button s
>tates (disabled, checked, checked disabled, pressed, and indeterminate=
) as needed. The button-face
> bitmaps must use the following colors to allow the toolbar to create =
the button states:
>=B7       Black [RGB(000,000,000)] for symbols and text.
>=B7       Dark gray [RGB(128,128,128)] for shadows (edge shading).
>=B7       Bright gray [RGB(192,192,192)] for the button face (face sha=
ding).
>=B7       White [RGB(255,255,255)] for selected button color.
>=B7       Blue [RGB(000,000,255)] to add color to the button face (opt=
ional).
>=B7       Magenta [RGB(255,000,255)] to add color to the button face (=
optional).
> =20
>The toolbar supports the user's color choices for buttons and windows.=
 It automatically translates
> the colors listed above to the colors selected by the user, as follow=
s:
>=B7       Black is translated to COLOR_BTNTEXT.
>=B7       Dark gray is translated to COLOR_BTNSHADOW.
>=B7       Bright gray is translated to COLOR_BTNFACE.
>=B7       White is translated to COLOR_BTNHIGHLIGHT.
>=B7       Blue is translated to COLOR_HIGHLIGHT.
>=B7       Magenta is translated to COLOR_WINDOW.

You can circumvent this by using colours that are similar to the full
colors (eg. RGB(0,0,250) and RGB(250,0,250).

--=20
"I make no mistakes,         Helmut Muelner/M\"ulner/Mülner/M\x0FC=
lner
     only experiences."                                        =20
                            Phone  ++43/316/873-5643   FAX ++43/316/824=
 394
Graz, Austria (Home of Hyper-G,  http://www.iicm.edu)




Become an MFC-L member | Вернуться в корень Архива |