Pizzor2000
02-04-2011, 11:01 AM
How would I add a toolbox bitmap to a control in vb.Net? I did find the <ToolboxBitmap ...> statement, but I'm still confused on the best way to use it. I also haven't found a good explanation of actually adding a bitmap resource to a project.
PlausiblyDamp
02-05-2011, 05:44 PM
If you google ToolboxBitmap the very first article is a link to msdn which includes two snippets of code for how to use it - by referencing an absolute file path or by referencing a resource.
To add a bitmap as a resource you can go to the project properties, resources tab and then from the button labelled "Add Resource" you can add a resource.
Pizzor2000
02-08-2011, 01:02 PM
To add a bitmap as a resource you can go to the project properties, resources tab and then from the button labelled "Add Resource" you can add a resource.
Thanks. I just added a 16 x 16 bitmap resource, named tbxMyControl.
Is this code correct to add the bitmap to my control?:
<ToolboxBitmap(GetType(MyControl), "tbxMyControl")> _
Public Class MyControl
End Class
Because the control still shows the generic gear icon on my test project.
PlausiblyDamp
02-10-2011, 05:04 AM
It should work, the only thing I can think of is if the resource name also needs a namespace applied to it. e.g. if you application is called App1 then the resource name might be App1.tbxMyControl