Exemplo n.º 1
0
 /// <summary>
 /// 设置属性页
 /// </summary>
 /// <param name="pTabControl"></param>
 internal void SetTabControl(TabControl pTabControl)
 {
     this._tabControl = pTabControl;
 }
Exemplo n.º 2
0
 /// <summary>
 /// 设置属性页
 /// </summary>
 /// <param name="pTabControl"></param>
 internal void SetTabControl(TabControl pTabControl)
 {
     this._tabControl = pTabControl;
 }
Exemplo n.º 3
0
        /// <summary>
        /// 编辑组件
        /// </summary>
        /// <param name="context"></param>
        /// <param name="component"></param>
        /// <param name="owner"></param>
        /// <returns></returns>
        public override bool EditComponent(ITypeDescriptorContext context, object component, IWin32Window owner)
        {
            TabControl              oControl      = (TabControl)component;
            IServiceProvider        site          = oControl.Site;
            IComponentChangeService changeService = null;

            DesignerTransaction transaction = null;
            bool changed = false;

            try
            {
                if (site != null)
                {
                    IDesignerHost designerHost = (IDesignerHost)site.GetService(typeof(IDesignerHost));
                    transaction = designerHost.CreateTransaction("BuildTabStrip");

                    changeService = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
                    if (changeService != null)
                    {
                        try
                        {
                            changeService.OnComponentChanging(component, null);
                        }
                        catch (CheckoutException ex)
                        {
                            if (ex == CheckoutException.Canceled)
                            {
                                return(false);
                            }
                            throw ex;
                        }
                    }
                }

                try
                {
                    TabEditorForm oEditorForm = new TabEditorForm(oControl);
                    if (oEditorForm.ShowDialog(owner) == DialogResult.OK)
                    {
                        changed = true;
                    }
                }
                finally
                {
                    if (changed && changeService != null)
                    {
                        changeService.OnComponentChanged(oControl, null, null, null);
                    }
                }
            }
            finally
            {
                if (transaction != null)
                {
                    if (changed)
                    {
                        transaction.Commit();
                    }
                    else
                    {
                        transaction.Cancel();
                    }
                }
            }

            return(changed);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="i_tabControl"></param>
 internal TabPageCollection(TabControl i_tabControl)
 {
     this._tabControl = i_tabControl;
 }