Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / January 2008

Tip: Looking for answers? Try searching our database.

Add Icon To Toolbar

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lamblion - 27 Jan 2008 19:53 GMT
I am new to programming, so please bear with my ingorance...

To begin, I have no problem adding the standard controls to my toolbar, such
as STD_FILENEW, and so on, but I can't figure out how to add my own
customized icon to a button on the toolbar.

I've added the icon to my resource file and assigned an ID value to it, and
I've also used LoadIcon or LoadImage just to try to make it work, but no
matter what I do, when I code the following --

tbb[2].iBitmap = IDI_MYICON;
tbb[2].fsState = TBSTATE_ENABLED;
tbb[2].fsStyle = TBSTYLE_BUTTON;
tbb[2].idCommand = IDM_CLOSE;

-- the button shows up but not the icon, i.e., it's just a flat gray area
with no icon, even though the button is fully functional.

Please tell me what I am missing.
Mark Salsbery [MVP] - 28 Jan 2008 18:43 GMT
> I am new to programming, so please bear with my ingorance...
>
[quoted text clipped - 9 lines]
>
> tbb[2].iBitmap = IDI_MYICON;

iBitmap should be the index of the bitmap in the imagelist associated with
the toolbar, not a resource ID.

An icon can be added to an imagelist using ImageList_ReplaceIcon().

Mark

Signature

Mark Salsbery
Microsoft MVP - Visual C++

> tbb[2].fsState = TBSTATE_ENABLED;
> tbb[2].fsStyle = TBSTYLE_BUTTON;
[quoted text clipped - 4 lines]
>
> Please tell me what I am missing.
Lamblion - 29 Jan 2008 00:25 GMT
Thank you very much, Mark. I will give this a go and see how I fare.

> > I am new to programming, so please bear with my ingorance...
> >
[quoted text clipped - 25 lines]
> >
> > Please tell me what I am missing.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.