定义一个类,继承ToolboxService,需要using哪些
在做自定义界面的时候,要用到toolbox,于是自定义一个类,继承ToolboxService
但是调试的时候发现少了引用,我已经引用了
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Windows.Forms;
using System.ComponentModel.Design;
using System.Drawing.Design;
另外,如果定义好了,改如何封装呢?
------解决方案--------------------没有用过 帮顶!
------解决方案--------------------帮顶
------解决方案--------------------^_^,加下面的吧,
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
------解决方案--------------------新建一个窗体,拖一个到窗体上看看就知道
------解决方案--------------------using System;
using System.Windows.Forms;
using System.Drawing.Design;
namespace Hosting
{
internal class ToolboxService : ListBox, IToolboxService
{
internal Control designPanel = null;
public ToolboxService()
{
}
public void AddCreator(System.Drawing.Design.ToolboxItemCreatorCallback creator, string format, System.ComponentModel.Design.IDesignerHost host)
{
// No implementation
}
public void AddCreator(System.Drawing.Design.ToolboxItemCreatorCallback creator, string format)
{
// No implementation
}
public void AddLinkedToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem, string category, System.ComponentModel.Design.IDesignerHost host)
{
// No implementation
}
public void AddLinkedToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem, System.ComponentModel.Design.IDesignerHost host)
{
// No implementation
}
public void AddToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem, string category)
{
AddToolboxItem(toolboxItem);
}
public void AddToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem)
{
Items.Add(toolboxItem);
}
public System.Drawing.Design.ToolboxItem DeserializeToolboxItem(object serializedObject, System.ComponentModel.Design.IDesignerHost host)
{
return null;
}
public System.Drawing.Design.ToolboxItem DeserializeToolboxItem(object serializedObject)
{
return null;
}
public System.Drawing.Design.ToolboxItem GetSelectedToolboxItem(System.ComponentModel.Design.IDesignerHost host)
{
return GetSelectedToolboxItem();
}
public System.Drawing.Design.ToolboxItem GetSelectedToolboxItem()
{
if (base.SelectedIndex == -1)
return null;
else
return (ToolboxItem)base.SelectedItem;
}
public System.Drawing.Design.ToolboxItemCollection GetToolboxItems(string category, System.ComponentModel.Design.IDesignerHost host)
{
return GetToolboxItems();
}
public System.Drawing.Design.ToolboxItemCollection GetToolboxItems(string category)
{
return GetToolboxItems();
}
public System.Drawing.Design.ToolboxItemCollection GetToolboxItems(System.ComponentModel.Design.IDesignerHost host)
{
return GetToolboxItems();
}
public System.Drawing.Design.ToolboxItemCollection GetToolboxItems()
{
ToolboxItem[] t = new ToolboxItem[Items.Count];
Items.CopyTo(t, 0);
return new ToolboxItemCollection(t);