Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Thanks! Awesome group. I put out a simple question in the access/vba forum that I couldn't find answered on technet or anywhere else on the web and it was answered the same day!!..."

Geography

Where in the world do Tek-Tips members come from?
Vachaun22 (Programmer)
3 Nov 03 14:42
Currently I'm using an API driven imagelist in my application.  My question is, is there anyway to load an icon on a command button when the form is loaded and keep the icon on the button for the life of the application?  I can get the icon on the button after the program is running, but I am looking to "build" a toolbar in code just using command button control array and use icons on these buttons from the api imagelist (unless someone knows how to put xp style icons on a toolbar control).  Thanks in advance.
grtammi (Programmer)
4 Nov 03 17:11
Vachaun22,

You could retrieve a list of controls and associated icons from a table that you store in your database - dunno if it would work really efficiently though.

Something like:

Private Sub Form_Load()
   
  ' 1 - retrieve list of all controls for this form
  ' 2 - set each control name returned to it's appropriate icon

End Sub

I'm guessing from this example your table would have fields something similar to the follows:

[form name], [control name], [image path]

It's a way to make it look like the icon is there for the life of the application - like I said though ... it may bog you down performance wise, especially if you have a lot of controls on your form.

HTH

Greg Tammi, IT Design & Consultation
Work: http://www.atsbell.com
Home: http://members.shaw.ca/gregandliz

Vachaun22 (Programmer)
4 Nov 03 22:38
grtammi,

thanks for the response, but not exactly what i'm looking for.  i have all the icons loaded in an API imagelist, and i can already get the icon loaded on the command button.  but my real issue comes with form repainting, and control repainting.  when the form refreshes, obviously the icon disappears, same with a control repaint.  i have come to the conclusion that subclassing is going to have to be done to create a custom repaint procedure, or to make an owner draw control.  unfortunately, all the code i have found so far on the latter has absolutely no commenting in it, so i have no clue what's happening.  if anyone can give me a real life example of form subclassing and/or owner draw controls, that'd be great.  Thanks again.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close