Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to use icon from application resources folder i don't want to use in this way

<system.drawing.toolboxbitmap("c:\usercontrolicon\bin\debug\icon.ico")>

Use in this way
<system.drawing.toolboxbitmap(global.usercontrolicon.my.resources.icon)>

What I have tried:

<system.drawing.toolboxbitmap("c:\usercontrolicon\bin\debug\icon.ico")>
<system.drawing.toolboxbitmap(global.usercontrolicon.my.resources.icon)>
Partial Public Class ControlIcon
Inherits Windows.Forms.TextBox


End Class
End Namespace
Posted
Updated 10-Jul-19 5:38am

1 solution

ToolboxBitmapAttribute(Type, String)[^]
With this overload of the constructor, you will be able to specify the icon as an embedded resource in the assembly.

First, in the Solution Explorer, select the icon.ico file, and in the Properties window, set the build action for the icon to EmbeddedResource.

Then, declare the attribute this way:
VB
<System.Drawing.ToolboxBitmap(GetType(ControlIcon), "icon.ico")> _
Partial Public Class ControlIcon
Inherits Windows.Forms.TextBox
 
Share this answer
 
Comments
Computechsoft 10-Jul-19 15:38pm    
Thanks phil.o Its help full very easy to control icon

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900