BS_BITMAP Style Not Working in CMainFrame
MICHAEL@datatree.com
Monday, July 01, 1996
Environment: VC++ 4.1 and Windows 95
I am using the sample code from PSS ID Number
Q125673 to create a button, with an attached
bitmap, in the client area of my application.
The title of the article is "New Windows 95
Styles Make Attaching Bitmap to Button Easier".
The button (and the bitmap) are displayed as
expected. The only problem I have not been able
to solve is how to make the button show the
"pressed in", or selected state, when I click
on it with the left mouse button.
I was able to trap the click in my subclassed MDI
client window (see the code below.) But I've
really struggled trying to achieve the aforementioned
"pressed in" look. Any ideas?
void CMDIClientWnd::OnLButtonUp(UINT nFlags, CPoint point)
{
CRect cRect(XCOORD, YCOORD, (XCOORD+WIDTH-1), YCOORD+HEIGHT-1));
if (cRect.PtInRect(point))
{
MessageBeep(0); // Sample code - do nothing.
}
CWnd::OnLButtonUp(nFlags, point);
}
IMPORTANT: The button DOES show the "pressed in" look if I create
the button in my subclassed MDI Client Window, unfortunately I
encounter even more significant problems than when I use CMainFrame.
Namely, I cannot find any sample code on how to trap the mouse
messages - like OnLButtonUp.
---------------------------
Michael L. Thal
Data Tree Corporation
voice: (619) 231-3300
fax: (619) 231-3301
Mario Contestabile -- Mario_Contestabile.UOS__MTL@UOSMTL2.universal.com
Monday, July 08, 1996
===Snip()=====
The button (and the bitmap) are displayed as
expected. The only problem I have not been able
to solve is how to make the button show the
"pressed in", or selected state, when I click
on it with the left mouse button.
===SnipEnd()=====
Use CBitmapButton instead of the BS_BITMAP style.
The four states will automatically be drawn for you,
and can be used under NT also, unlike the BS_BITMAP style.
mcontest@universal.com
| Вернуться в корень Архива
|