-
Apr 28th, 2005, 01:17 PM
#1
Thread Starter
Frenzied Member
VB.net/c# HowTo add bitmap's to your user controls
If you've ever created a user control, particularly an inherited control, you've noticed that the icon to the left of your new control in the toolbox is simply a gear. With the below code, you can add the icon from an existing control:
VB Code:
<ToolboxBitmap(GetType(System.Windows.Forms.TextBox))> _
Public Class TextBox
Inherits System.Windows.Forms.TextBox
End Class
or in C#
VB Code:
[ToolboxBitmap(typeof(Button))]
class MyControl1 : UserControl
{
}
more information can be found Here
Last edited by Andy; Apr 28th, 2005 at 02:15 PM.
-
May 6th, 2005, 07:56 AM
#2
Thread Starter
Frenzied Member
Re: VB.net/c# HowTo add bitmap's to your user controls
I learned of another method too:
add a 16X16 BITMAP to the project and in the bitmap's property page, set the BuildAction to 'EmbeddedResource'...
This puts the bitmap in the assembly file and becomes part of the code. When you add the compiled .dll to your toolbox, the icon will automatically be there.
neat, huh?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|