Iraklis
asked on
CButton question
Is there any way to avoid the surrounding line which appears on a button when it gets the focus? (the button may be an ownwerdrawn button).
Code would help for solution.
Thank.
Code would help for solution.
Thank.
You can save your button images as resources, and then use CBitmapButton::LoadBitmaps (), which allows you to tell the application what you want the face to look like very easily.
CBitmapButton works like a button, but you can load the 4 different images into the button with LoadBitmaps().
BOOL LoadBitmaps( LPCTSTR lpszBitmapResource, //The button looks
LPCTSTR lpszBitmapResourceSel = NULL, //When it is selected
LPCTSTR lpszBitmapResourceFocus = NULL, //When it has focus **You want this to be the same as lpszBitmapResourceSel I believe
LPCTSTR lpszBitmapResourceDisabled = NULL //When it is disabled
);
CBitmapButton works like a button, but you can load the 4 different images into the button with LoadBitmaps().
BOOL LoadBitmaps( LPCTSTR lpszBitmapResource, //The button looks
LPCTSTR lpszBitmapResourceSel = NULL, //When it is selected
LPCTSTR lpszBitmapResourceFocus = NULL, //When it has focus **You want this to be the same as lpszBitmapResourceSel I believe
LPCTSTR lpszBitmapResourceDisabled
);
Regular messages like WS_SETFOCUS will reach directly to controls like CButton.CButton::SetFocus has implemetation for focus rectangle.If you can override this you may not get input focus rectangle.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok. I'll split up the points.
Iraklis
I reduced the points, please accept Crius comment as an answer.
armaze and mblat, there will be a separate question with points for your help.
** Mindphaser - Community Support Moderator **
I reduced the points, please accept Crius comment as an answer.
armaze and mblat, there will be a separate question with points for your help.
** Mindphaser - Community Support Moderator **
hi Iraklis ,
I think you partially agreed with my answer.
I think you partially agreed with my answer.
Mindphaser created a separate question with points for your help Amarzee.
Basically WM_DRAWITEM receives DRAWITEMSTRUCT as a parameter.
It has itemState member var, that can be inspected to find out if item is in focus and draw focus rectangle. If you won't do that no rectangle will be drawn.
goto to www.codeguru.com they have many, many examples of owner drawn buttons....
hope it helps...