/// <summary> /// Retrieves the HTML to display in the designer. /// </summary> /// <returns>HTML for the designer.</returns> public override string GetDesignTimeHtml() { string html; MultiPage multiPage = (MultiPage)Component; int realIndex = 0; if (multiPage.Controls.Count == 0) { // Add a message if the MultiPage is empty return(CreatePlaceHolderDesignTimeHtml(DesignUtil.GetStringResource("MultiPageNoItems"))); } realIndex = multiPage.SelectedIndex; if (_SelectedIndex < 0) { _SelectedIndex = realIndex; } multiPage.SelectedIndex = _SelectedIndex; try { html = base.GetDesignTimeHtml(); } finally { // Restore the component multiPage.SelectedIndex = realIndex; } return(html); }
/// <summary> /// Retrieves the HTML to display in the designer. /// </summary> /// <returns>The design-time HTML.</returns> public override string GetDesignTimeHtml() { TabStrip strip = (TabStrip)Component; // If the tabstrip is empty, then add a label with instructions if (strip.Items.Count == 0) { return(CreatePlaceHolderDesignTimeHtml(DesignUtil.GetStringResource("TabStripNoItems"))); } return(base.GetDesignTimeHtml()); }
/// <summary> /// Retrieves the HTML to display in the designer. /// </summary> /// <returns>The design-time HTML.</returns> public override string GetDesignTimeHtml() { TreeView tv = (TreeView)Component; // If the TreeView is empty, then show instructions if (tv.Nodes.Count == 0) { return(CreatePlaceHolderDesignTimeHtml(DesignUtil.GetStringResource("TreePlaceHolder"))); } return(base.GetDesignTimeHtml()); }
/// <summary> /// Called when a part of the component is changing. /// </summary> /// <param name="sender">Sender object</param> /// <param name="ce">Event arguments</param> public override void OnComponentChanged(object sender, ComponentChangedEventArgs ce) { base.OnComponentChanged(sender, ce); PropertyDescriptor selIndexDesc = DesignUtil.GetPropertyDescriptor(Component, "SelectedIndex"); if ((selIndexDesc != null) && (ce.Member == selIndexDesc)) { SelectedIndex = (int)ce.NewValue; UpdateDesignTimeHtml(); } }
/// <summary> /// Called when the Add Separator menu item is clicked. /// </summary> /// <param name="sender">The source object</param> /// <param name="e">Event arguments</param> private void OnAddSep(object sender, EventArgs e) { TabStrip strip = (TabStrip)Component; PropertyDescriptor itemsDesc = DesignUtil.GetPropertyDescriptor(strip, "Items"); if (itemsDesc != null) { // Tell the designer that we're changing the property RaiseComponentChanging(itemsDesc); // Do the change TabSeparator sep = new TabSeparator(); strip.Items.Add(sep); // Tell the designer that we've changed the property RaiseComponentChanged(itemsDesc, null, null); UpdateDesignTimeHtml(); } }
/// <summary> /// Called when the Add Button menu item is clicked. /// </summary> /// <param name="sender">The source object</param> /// <param name="e">Event arguments</param> private void OnAddButton(object sender, EventArgs e) { Toolbar tbar = (Toolbar)Component; PropertyDescriptor itemsDesc = DesignUtil.GetPropertyDescriptor(tbar, "Items"); if (itemsDesc != null) { // Tell the designer that we're changing the property RaiseComponentChanging(itemsDesc); // Do the change ToolbarButton btn = new ToolbarButton(); btn.Text = "Button"; tbar.Items.Add(btn); // Tell the designer that we've changed the property RaiseComponentChanged(itemsDesc, null, null); UpdateDesignTimeHtml(); } }
/// <summary> /// Retrieves the HTML to display in the designer. /// </summary> /// <returns>The design-time HTML.</returns> public override string GetDesignTimeHtml() { string html; Toolbar tbar = (Toolbar)Component; // If the toolbar is empty, then add a label with instructions if (tbar.Items.Count == 0) { return(CreatePlaceHolderDesignTimeHtml(DesignUtil.GetStringResource("ToolbarNoItems"))); } bool madeBlock = false; Unit oldUnit = Unit.Empty; object obj = Behavior.GetStyleAttribute("position", false, true); bool notAbsolute = true; if ((obj != null) && (obj is string)) { notAbsolute = (String.Compare((string)obj, "absolute", true) != 0); } if ((tbar.Width == Unit.Empty) && notAbsolute) { madeBlock = true; oldUnit = tbar.Width; tbar.Width = Unit.Percentage(100.0); } try { html = base.GetDesignTimeHtml(); } finally { if (madeBlock) { tbar.Width = oldUnit; } } return(html); }