Toolbox Bitmap doesn't show up

  • Thread starter Thread starter Wallace Pipp
  • Start date Start date
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
 
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
 
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
 
Back
Top