在添加工具箱项中发现出现的是2个名称的控件(分别是xp,Tool).------------------------------------------------------请问怎样才能在添加工具箱项中只显示一个名字(比如bear),而添加后在工具箱中能显示多个控件了(xp,Tool)

解决方案 »

  1.   

    你做一个用户控件的工程,然后加第二个用户控件时,用项目里面的添加用户控件。这样编译出来后只有一个dll。然后你把这个dll添加工具到工具箱里。就可以看到是二个用户控件!
      

  2.   

    试试吧,不过好象第一个也会加上:)namespace WindowsControlLibrary1
    {
    /// <summary>
    /// UserControl1 的摘要说明。
    /// </summary>
    public class bear: System.Windows.Forms.UserControl
    {

    public class xp : System.Windows.Forms.UserControl
    {
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null; public xp()
    {
    // 该调用是 Windows.Forms 窗体设计器所必需的。
    InitializeComponent(); // TODO: 在 InitComponent 调用后添加任何初始化 } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if( components != null )
    components.Dispose();
    }
    base.Dispose( disposing );
    } #region 组件设计器生成的代码
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器 
    /// 修改此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    components = new System.ComponentModel.Container();
    }
    #endregion
    }
    public class Tool: System.Windows.Forms.UserControl
    {
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null; public Tool()
    {
    // 该调用是 Windows.Forms 窗体设计器所必需的。
    InitializeComponent(); // TODO: 在 InitComponent 调用后添加任何初始化 } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if( components != null )
    components.Dispose();
    }
    base.Dispose( disposing );
    } #region 组件设计器生成的代码
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器 
    /// 修改此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    components = new System.ComponentModel.Container();
    }
    #endregion
    }
    }
    }
      

  3.   

    在你不想显示的那个类前面加上[ToolboxItem(false)]