Changing the font for list box items....

BrianRaymond
BrianRaymond used Ask the Experts™
on
I would like to make only certain items in a list box to appear bold (al a: the procedure drop down list in the VB code editor when you have code for an event).  I am assuming that I need to use the SendDlgItemMessage API routine.  However, I am unable to find any documentation on how to accomplish this.

Any ideas or help would be appreciated.
Brian
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
No comment at this time.

Commented:
found this website.  It's in C but you should be able to translate it to VB.

http://www.developer.com/net/cplus/article.php/628181

HTH

Author

Commented:
Thank you for the article, but it simply showed the syntax for the SendDlgItemMessage routine.  I am more interested in the parameter values that I would need to use to make a single item in a list box to appear bold.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Commented:
OK, found one more article on EE.  Check out this thread:

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20273578.html

It uses the List View control, not the listbox control, which may be a better solution for you.

HTH

Author

Commented:
HTH-

Thank you for your suggestion.  I would really like to accomplish this without the need of any ActiveX controls.  I have one solution in place, simply change the listbox's style to a CheckBox.  That seems to be working and providing ample feedback to the users.  However, I would really like to know how Microsoft has accomplished this.  

I have seen listboxes and comboboxes where the background of each item in the list is a separate color.  This was done using the SendDlgItemMessage API routine.  Logic would therefore dictate that you can also change the font of each item.  I now just searching for the answer to this question.  I refuse to believe that it simply cannot be done.

Thanks again and keep the ideas coming.
Brian
Author of the Year 2009

Commented:
Hi BrianRaymond,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept dds110's comment(s) as an answer.
    **** ListView is how Microsoft does it

BrianRaymond, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept THIS comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
Commented:
BrianRaymond,

I wish to apologize for the fact that I've not been of much help other than to offer links to related articles.  As I type this response, I'm on vacation at my parents house (i.e. away from my computer).  Normally, for a question of this type and complexity, I would attempt to write the code myself before posting anything but I agree with you that this has been done before.  The only other thing I can think of is to subclass the Listbox control so as a last resort, I offer a few links about subclassing.  I hope you can find an answer to your question.


http://www.elitevb.com/content/01%2C0007%2C01/01.aspx

http://www.mvps.org/vbvision/grouped_demos.htm#Listbox_&_Combobox  (Look for Virtual Listbox Demo.zip (34KB) )

http://beta.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20274110.html

 
Best of luck to you.

DDS
A sample of how to do this is on TheScarms:
http://www.thescarms.com/vbasic/OwnerDrawn.asp

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial