using CDC::DrawState()
Serge Lalonde -- serge@infolytica.qc.ca
Thursday, October 24, 1996
Environment: VC++ 4.2, NT 4.0
Hi there!
Has anyone ever successfully used the CDC::DrawState() method to draw
a disabled and embossed bitmap? The documentation seems clear and simple
enough, but when I use it like so
pDC->DrawState(rect.TopLeft(), rect.Size(), &bitmap, DSS_DISABLED);
all I get is a dark grey in the rectangle that is specified. I thought
that this is what the toolbars use to draw their buttons when disabled
(which is what I really want).
It sortof works if my bitmap is in black and white only, but that wouldn't
be very useful, and besides the documentation makes no mention of this
limitation.
Any suggestions on how to use it properly or alternatively, how can I draw
a CBitmap to look greyed and embossed like toolbar buttons?
Thanks.
--
Have a tremendous day!
_/_/_/_/ _/_/_/_/ _/_/_/ _/_/_/ _/_/_/_// 300 Leo Parizeau, Suite 2222
_/ _/ _/ _/ _/ _/ / Montreal, PQ, Canada H2W 2P4
_/_/_/_/ _/_/_/ _/_/_/_/ _/ _/_/ _/_/_/ / Voice: (514) 849-8752 x236
_/ _/ _/ _/ _/ _/ _/ /__Fax: (514) 849-4239__
_/_/_/_/ _/_/_/_/ _/ _/ _/_/_/ _/_/_/_/ Lalonde, Infolytica Corp.
Randy Taylor -- randy_taylor@ebt.com
Sunday, October 27, 1996
[Mini-digest: 2 responses]
> Has anyone ever successfully used the CDC::DrawState() method to draw
> a disabled and embossed bitmap?
yes, my code looks like this:
if (GetListCtrl().GetItemState(lvitem.iItem, LVIS_CUT) & LVIS_CUT &&
afxData.bWin4) {
// PAINT CUT ITEM ICON (WIN4 ONLY)
HICON hIcon = imageList_small.ExtractIcon( lvitem.iImage );
VERIFY(::DrawState(
cdc.GetSafeHdc(), // handle to device context
NULL, // handle to brush
NULL, // pointer to callback function
MAKELPARAM (hIcon, 0), // image information
NULL, // more image information
pt.x, // horizontal location of image
pt.y, // vertical location of image
WIDTH_OF_ITEM_ICON, // width of image
WIDTH_OF_ITEM_ICON, // height of image
DST_ICON | DSS_DISABLED)); // image type and state
} else {
VERIFY (imageList_small.Draw
(&cdc, lvitem.iImage, pt, ILD_TRANSPARENT));
}
> The documentation seems clear and simple
> enough, but when I use it like so
>
> pDC->DrawState(rect.TopLeft(), rect.Size(), &bitmap, DSS_DISABLED);
>
> all I get is a dark grey in the rectangle that is specified. I thought
> that this is what the toolbars use to draw their buttons when disabled
> (which is what I really want).
I think it is.
> It sortof works if my bitmap is in black and white only, but that
wouldn't
> be very useful, and besides the documentation makes no mention of this
> limitation.
Try using the WIN32 version, like my code did... just for fun.
> Any suggestions on how to use it properly or alternatively, how can I
draw
> a CBitmap to look greyed and embossed like toolbar buttons?
-----From: Jim Barry
I've never used this function myself, but it looks to me like you forgot
to specify the DST_BITMAP flag.
Cheers,
- Jim
| Вернуться в корень Архива
|