Toolbox Bitmap doesn't show up

W

Wallace Pipp

Hello all,

I created a bitmap with my control, but the bitmap(MyControl.bmp) doesn't
show up on the toolbar. Here's what I tried:

[ToolboxItem(true)]
[ToolboxBitmap(typeof(MyControl))]
public class MyControl : System.Windows.Forms.Control
{
...
}

Thanks for any help,
Wally
 
O

Octavio Hernandez

Wally,

The constructor you're using
[ToolboxBitmap(typeof(Button))]
public class MyControl...

is for assigning a component class THE SAME bitmap another class uses. For
instance, here I assign for MyControl the bitmap of the Button class.

You should use the other constructor:
[ToolboxBitmap(@"C:\Documents and Settings\Wally\Images\MyControl.bmp")]
public class MyControl...

Check out this link:

http://msdn.microsoft.com/library/d...vbtskProvidingToolboxBitmapForYourControl.asp

Regards - Octavio


Wallace Pipp said:
Hello all,

I created a bitmap with my control, but the bitmap(MyControl.bmp) doesn't
show up on the toolbar. Here's what I tried:

[ToolboxItem(true)]
[ToolboxBitmap(typeof(MyControl))]
public class MyControl : System.Windows.Forms.Control
{
...
}

Thanks for any help,
Wally
 
W

Wallace Pipp

Thanks, Octavio, just what I was looking for.

Wally

Octavio Hernandez said:
Wally,

The constructor you're using
[ToolboxBitmap(typeof(Button))]
public class MyControl...

is for assigning a component class THE SAME bitmap another class uses. For
instance, here I assign for MyControl the bitmap of the Button class.

You should use the other constructor:
[ToolboxBitmap(@"C:\Documents and Settings\Wally\Images\MyControl.bmp")]
public class MyControl...

Check out this link:

http://msdn.microsoft.com/library/d...vbtskProvidingToolboxBitmapForYourControl.asp

Regards - Octavio


Wallace Pipp said:
Hello all,

I created a bitmap with my control, but the bitmap(MyControl.bmp) doesn't
show up on the toolbar. Here's what I tried:

[ToolboxItem(true)]
[ToolboxBitmap(typeof(MyControl))]
public class MyControl : System.Windows.Forms.Control
{
...
}

Thanks for any help,
Wally
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top