protected override IComponent[] CreateToolCore(ToolboxItem tool, int x, int y, int width, int height, bool hasLocation, bool hasSize)
 {
     if (tool != null)
     {
         System.Type c = tool.GetType(this.designerHost);
         if (!typeof(ToolStrip).IsAssignableFrom(c))
         {
             ToolStripContainer parent = this.panel.Parent as ToolStripContainer;
             if (parent != null)
             {
                 ToolStripContentPanel contentPanel = parent.ContentPanel;
                 if (contentPanel != null)
                 {
                     PanelDesigner toInvoke = this.designerHost.GetDesigner(contentPanel) as PanelDesigner;
                     if (toInvoke != null)
                     {
                         ParentControlDesigner.InvokeCreateTool(toInvoke, tool);
                     }
                 }
             }
         }
         else
         {
             base.CreateToolCore(tool, x, y, width, height, hasLocation, hasSize);
         }
     }
     return null;
 }
		public ToolboxItemToolboxNode (ToolboxItem item)
			: base (item.TypeName, item.AssemblyName.FullName)
		{
			base.Name = item.DisplayName;
			if (item.Bitmap != null)
				base.Icon = ImageToPixbuf (item.Bitmap);
			
			foreach (ToolboxItemFilterAttribute tbfa in item.Filter)
				base.ItemFilters.Add (tbfa);
			
			//we only need to serialise the ToolboxItem if it is non-standard, because we can reliably recreate the two built-in types
			if (item.GetType () == typeof (ToolboxItem))
				toolboxItemType = null; //no-op, but this has consequences 	
			else if (item.GetType () == typeof (System.Web.UI.Design.WebControlToolboxItem))
				toolboxItemType = new TypeReference (typeof (System.Web.UI.Design.WebControlToolboxItem));
			else {
				serializedToolboxItem = SerializeToolboxItem (item);
				toolboxItemType = new TypeReference (item.GetType ());
			} 
		}
Beispiel #3
0
		public void GetType_Null ()
		{
			ToolboxItem item = new ToolboxItem ();
			Assert.IsNull (item.GetType (null), "GetType(null)");
		}
 protected override IComponent[] CreateToolCore(ToolboxItem tool, int x, int y, int width, int height, bool hasLocation, bool hasSize)
 {
     if (tool != null)
     {
         System.Type c = tool.GetType(this.designerHost);
         if (typeof(StatusStrip).IsAssignableFrom(c))
         {
             ParentControlDesigner.InvokeCreateTool(this.GetDesigner(this.bottomToolStripPanel), tool);
         }
         else if (typeof(ToolStrip).IsAssignableFrom(c))
         {
             ParentControlDesigner.InvokeCreateTool(this.GetDesigner(this.topToolStripPanel), tool);
         }
         else
         {
             ParentControlDesigner.InvokeCreateTool(this.GetDesigner(this.contentToolStripPanel), tool);
         }
     }
     return null;
 }