示例#1
0
        /// <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();
            }
        }
示例#2
0
        /// <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();
            }
        }
示例#3
0
        /// <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();
            }
        }