示例#1
0
        /// <summary>
        /// Provides core functionality for all the <see cref="M:System.Windows.Forms.Design.ParentControlDesigner.CreateTool(System.Drawing.Design.ToolboxItem)" /> methods.
        /// </summary>
        /// <param name="tool">The <see cref="T:System.Drawing.Design.ToolboxItem" /> to create a component from.</param>
        /// <param name="x">The horizontal position, in design-time view coordinates, of the location of the left edge of the tool, if a size is specified; the horizontal position of the center of the tool, if no size is specified.</param>
        /// <param name="y">The vertical position, in design-time view coordinates, of the location of the top edge of the tool, if a size is specified; the vertical position of the center of the tool, if no size is specified.</param>
        /// <param name="width">The width of the tool. This parameter is ignored if the <paramref name="hasSize" /> parameter is set to false.</param>
        /// <param name="height">The height of the tool. This parameter is ignored if the <paramref name="hasSize" /> parameter is set to false.</param>
        /// <param name="hasLocation">true if a location for the component is specified; false if the component is to be positioned in the center of the currently selected control.</param>
        /// <param name="hasSize">true if a size for the component is specified; false if the default height and width values for the component are to be used.</param>
        /// <returns>An array of components created from the tool.</returns>
        /// <exception cref="System.ArgumentException"></exception>
        protected override IComponent[] CreateToolCore(ToolboxItem tool, int x, int y, int width, int height, bool hasLocation, bool hasSize)
        {
            TabList       control;
            IDesignerHost host;

            control = this.TabListControl;

            // prevent controls from being created directly on the TabList
            if (control.SelectedPage == null)
            {
                throw new ArgumentException(string.Format("Cannot add control '{0}', no page is selected.", tool.DisplayName));
            }

            host = (IDesignerHost)this.GetService(typeof(IDesignerHost));
            if (host != null)
            {
                ParentControlDesigner childDesigner;

                childDesigner = (ParentControlDesigner)host.GetDesigner(control.SelectedPage);

                // add controls onto the TabListPage control instead of the TabList
                ParentControlDesigner.InvokeCreateTool(childDesigner, tool);
            }

            return(null);
        }
示例#2
0
        protected override IComponent[] CreateToolCore(ToolboxItem tool, int x, int y, int width, int height, bool hasLocation, bool hasSize)
        {
            WizardPageDesigner pageDes = GetSelectedWizardPageDesigner();

            if (pageDes != null)
            {
                ParentControlDesigner.InvokeCreateTool(pageDes, tool);
            }
            return(null);
        }
示例#3
0
		protected override IComponent[] CreateToolCore(ToolboxItem tool, int x, int y, int width, int height, bool hasLocation, bool hasSize)
		{
			if(this.Selected==null)
			{
				this.Selected=this.collapsibleContainerPanel;
			}
			CollapsibleContainerPanelDesigner toInvoke=(CollapsibleContainerPanelDesigner)this.designerHost.GetDesigner(this.Selected);
			ParentControlDesigner.InvokeCreateTool(toInvoke, tool);
			return null;
		}
示例#4
0
        protected override IComponent[] CreateToolCore(ToolboxItem tool, int x, int y, int width, int height, bool hasLocation, bool hasSize)
        {
            TabControl control = (TabControl)this.Control;

            if (control.SelectedTab == null)
            {
                throw new ArgumentException("TabControlInvalidTabPageType");
            }
            IDesignerHost service = (IDesignerHost)this.GetService(typeof(IDesignerHost));

            if (service != null)
            {
                TabPageDesigner toInvoke = (TabPageDesigner)service.GetDesigner(control.SelectedTab);
                ParentControlDesigner.InvokeCreateTool(toInvoke, tool);
            }
            return(null);
        }