Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Stephens' Visual Basic Programming 24-Hour Trainer
This is the forum to discuss the Wrox book Stephens' Visual Basic Programming 24-Hour Trainer by Rod Stephens; ISBN: 978-0-470-94335-9
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Stephens' Visual Basic Programming 24-Hour Trainer section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 6th, 2011, 01:39 PM
Authorized User
Points: 195, Level: 3
Points: 195, Level: 3 Points: 195, Level: 3 Points: 195, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Location: Tennessee
Posts: 46
Thanks: 27
Thanked 0 Times in 0 Posts
Default Lesson 6 Try It

After finishing the Lesson 6 Try It I decided to add 2 more features. When I changed the text color I changed the 'A' icon of the drop down button on the tool bar. That worked fine. I then tried to change the image of the background color drop down button on the tool bar. That did not work well. While working on the lesson I imported them from your downloaded code. Unfortunately they all are listed as 'System.Drawing.Bitmap'. I have the .bmp files listed in my Solution Explorer window and I can open them and see the icon. How do I change the icon on the tool bar to indicate the current background color?? I know it is redundant, but I just wanted to do it (I was playing and having fun). Thank you.

Keith Z.
Reply With Quote
  #2 (permalink)  
Old June 6th, 2011, 05:15 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,187, Level: 23
Points: 3,187, Level: 23 Points: 3,187, Level: 23 Points: 3,187, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 646
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Hi Keith,

I'm guessing you used code similar to the following to set the foreground color item's color:

Code:
btnTextColor.ForeColor = Color.Green
To set the background button's image, use code similar to the following:

Code:
btnBackgroundColor.Image = My.Resources.Green
The My namespace is covered briefly in Lesson 36 so you're getting a bit ahead but in a nutshell My contains shortcuts to useful items including project resources. In this case, the project includes files named Blue.bmp, Green.bmp, etc. so by default it gets resources holding the corresponding images named Blue, Green, etc.

The line of code above sets the button's Image property to the Green resource so you see the corresponding bitmap.

Quote:
I know it is redundant, but I just wanted to do it (I was playing and having fun).
That's an excellent way to learn this stuff! Think of changes you'd like to make and then try to make them.

Let me know if you have other questions or have trouble getting the images to work.

(Also post a review when you have a chance!)
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
The Following User Says Thank You to Rod Stephens For This Useful Post:
zavodney (June 6th, 2011)
  #3 (permalink)  
Old June 6th, 2011, 11:07 PM
Authorized User
Points: 195, Level: 3
Points: 195, Level: 3 Points: 195, Level: 3 Points: 195, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Location: Tennessee
Posts: 46
Thanks: 27
Thanked 0 Times in 0 Posts
Smile Thanks

My background icon is changing now, thank you. Yes, that is the code I used to change the text button icon.

Keith Z.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Lesson 5 exercises. thelemur BOOK: Java Programming 24-Hour Trainer by Yakov Fain 9 March 30th, 2013 12:56 AM
Lesson 2 - can not create Class BubNorth BOOK: Java Programming 24-Hour Trainer by Yakov Fain 1 March 4th, 2012 09:44 PM
Lesson 19B-Displaying Data in MVC Cybermaniac BOOK: ASP.NET 4 24-Hour Trainer 3 January 31st, 2012 08:16 AM
Lesson 3 question soneal777 BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer 1 August 30th, 2010 07:17 PM
Lesson on Event Calendar - Chapter 14 Mike Smith BOOK: Professional C#, 2nd and 3rd Editions 6 April 6th, 2004 04:03 PM



All times are GMT -4. The time now is 02:38 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.