 |
| Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book:
Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 22nd, 2004, 05:07 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Custom Icon
Hello,
I'm trying to create a custom bitmap for the icon of a windows control, so that when the control is added to the toolbox, it will appear with this new bitmap. What I was told was the image needs to be 16-bit, and be 16x16. I named the control Estimator. vb, and the 16 bit, 16x16 bitmap is named Estimated.bmp. They both are in the same directory, but it's not taking it. When I compile the project, it won't use it; uses standard gear.
I couldn't get this to work in 1.1/2003, and I can't get it to work in 2/2005. Any ideas?
Thanks,
Brian
__________________
Brian
|
|

October 15th, 2004, 09:01 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
Hi Brian,
I don't know if you have found the solution yet, and I haven't used 2005, but here is how you can do it in 2003.
Add a reference to the System.Drawing.dll in project explorer if it isn't already there. Use the Imports statement at the top of your code to add a reference to System.Drawing.
Change the name of your bitmap to the name of your class (NameOfClass.bmp). Change it's "Build Action" property to "Embedded Resource".
Add this line immediately before your class declaration:
<ToolboxBitmap(GetType(NameOfClass))> _
Don't forget to use the line continuation character.
Build the control. You should now have your image on the toolbar.
J
|
|

October 15th, 2004, 10:52 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Hey,
I was using the other constructor by providing the name to the file but it isn't "pulling it in" so to speak. It still uses the old icon. It's 16 color, 16x16 which is the requirements that I found.
I'll try that.
Brian
|
|

October 15th, 2004, 11:05 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Hey,
Still nothing.
Brian
|
|

October 15th, 2004, 12:11 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
Did you change it to a bitmap? If you want to send me the project, I can take a look at it.
Actually, it would probably be better if you just duplicated the changing of the icon in a 2003 project and sent that because I don't have 2005 installed. It should only take you a minute or so to do it.
J
|
|

October 15th, 2004, 12:58 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
16 x 16 bitmap.
|
|

October 15th, 2004, 01:00 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
And did you remove it from the toolbar and re-add it? Sorry if it seems like I am asking the obvious, but I am not really sure why you are having so much trouble.
J
|
|

October 29th, 2004, 01:45 PM
|
|
Registered User
|
|
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'm having exactly the same problem. The only way that I've been able to make it work is to use a string that contains the full path name. That's not the way I wanted to do it, but it worked.
|
|

May 11th, 2005, 01:50 AM
|
|
Authorized User
|
|
Join Date: May 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
maybe you can just rename the extension to *.ico
|
|

May 11th, 2005, 07:28 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
I think it's supposed to be a bitmap, though I gave up on this anyway.
Brian
|
|
 |