如何:为控件提供工具箱位图
如果希望在“工具箱”中为控件显示特殊图标,可以通过使用
通过使用
// Specifies the bitmap associated with the Button type. [ToolboxBitmap(typeof(Button))] class MyControl1 : UserControl { } // Specifies a bitmap file. [ToolboxBitmap(@"C:\Documents and Settings\Joe\MyPics\myImage.bmp")] class MyControl2 : UserControl { } // Specifies a type that indicates the assembly to search, and the name // of an image resource to look for. [ToolboxBitmap(typeof(MyControl), "MyControlBitmap")] class MyControl : UserControl { }
注意: |
---|
对于自动生成的控件和组件,位图将不出现在工具箱中。若要查看位图,请使用“选择工具箱项”对话框重新加载控件。 |