borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2009 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (plz check this subclassed command button)Next Topic (Rename the Start Button) New Topic New Poll Post Reply
AndreaVB Forum : API : what if not WM_DRAWITEM?
Poster Message
toughcoder
Level: Guest


icon what if not WM_DRAWITEM?

greetings every1,
i understand that if u change the style property of a command button to graphical, the forms recieves a WM_DRAWITEM msg. I can catch that and draw the button. But what msg is posted if the style property is Standard or better still how to draw the button when the style property is standard Plz help.

18-07-2004 at 07:30 AM
| Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: what if not WM_DRAWITEM?

Have you tried catching WM_CTLCOLORBTN. I never tried it myself, but it is worth trying. wParam holds a handle to the button's device context.

"The WM_CTLCOLORBTN message is sent to the parent window of a button when the button is about to be drawn. By responding to this message, the parent window can set a button's text and background colors. "

____________________________
If you find the answer helpful, please mark this topic as solved.

18-07-2004 at 08:19 PM
View Profile Send Email to User Show All Posts | Quote Reply
toughcoder
Level: Guest

icon Re: what if not WM_DRAWITEM?

thanx goran, that may come handy.  

19-07-2004 at 04:17 PM
| Quote Reply
Beltira
Level: Protégé

Registered: 04-08-2004
Posts: 4
icon Re: what if not WM_DRAWITEM?

WM_DRAWITEM is meant for owner drawn items.  If you want to handle drawing the control yourself, you have these choices:

1.  Owner draw style.
2.  Subclass the control and draw it.
3.  Create your own control.

Having done all three at one time or another, owner draw is far and away the best and easiest choice.

WM_CTLCOLORBTN is handy just to change to foreground or/and background of the button, but otherwise leave it the same.

____________________________
When I find my code in times of trouble,
Friends and colleagues come to me,
Speaking words of wisdom:
"Code in C."

04-08-2004 at 07:01 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : API : what if not WM_DRAWITEM?
Previous Topic (plz check this subclassed command button)Next Topic (Rename the Start Button) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2009 Andrea Tincaniborder