本文介绍了UserControl的工具箱说明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用C#创建了一个用户控件.它显示在工具箱的顶部.当我将鼠标悬停在其上方时,气球会显示其名称,版本以及.NET组件.罐装工具箱控件具有此描述,并提供少量说明.
I created a user control in C#. It shows up at the top of the toolbox. When I hover over it a balloon displays its name, version and that its a .NET Component. The canned toolbox controls have this and small description. How do I get a description of my user control to show up like the others?
推荐答案
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace Company.ItemConfigurationCS
{
// Set the display name and custom bitmap to use for this item.
// The build action for the bitmap must be "Embedded Resource".
[DisplayName("ToolboxMember 1 CS")]
[Description("Custom toolbox item from package ItemConfiguration.")]
[ToolboxItem(true)]
[ToolboxBitmap(typeof(Control1), "Control1.bmp")]
public partial class Control1 : UserControl
{
public Control1()
{
InitializeComponent();
button1.Text = this.Name + " Button";
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Hello world from " + this.ToString());
}
}
}
在类本身上使用description属性应该可以完成您想做的事情.
问候,
曼弗雷德(Manfred)
Using the description attribute on the class itself should do what you want.
Regards,
Manfred
这篇关于UserControl的工具箱说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!