当前位置: 首页>>代码示例>>C#>>正文


C# Design.ComponentEventArgs类代码示例

本文整理汇总了C#中System.ComponentModel.Design.ComponentEventArgs的典型用法代码示例。如果您正苦于以下问题:C# ComponentEventArgs类的具体用法?C# ComponentEventArgs怎么用?C# ComponentEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ComponentEventArgs类属于System.ComponentModel.Design命名空间,在下文中一共展示了ComponentEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnRemoving

        private void OnRemoving(object sender, ComponentEventArgs e)
        {
            IDesignerHost host = (IDesignerHost) GetService(typeof (IDesignerHost));

            //Removing a button
            if (e.Component is FATabStripItem)
            {
                FATabStripItem itm = e.Component as FATabStripItem;
                if (Control.Items.Contains(itm))
                {
                    changeService.OnComponentChanging(Control, null);
                    Control.RemoveTab(itm);
                    changeService.OnComponentChanged(Control, null, null, null);
                    return;
                }
            }

            if (e.Component is FATabStrip)
            {
                for (int i = Control.Items.Count - 1; i >= 0; i--)
                {
                    FATabStripItem itm = Control.Items[i];
                    changeService.OnComponentChanging(Control, null);
                    Control.RemoveTab(itm);
                    host.DestroyComponent(itm);
                    changeService.OnComponentChanged(Control, null, null, null);
                }
            }
        }
开发者ID:tbalci,项目名称:EFPT,代码行数:29,代码来源:FATabStripDesigner.cs

示例2: OnComponentRemoving

        private void OnComponentRemoving(object sender, ComponentEventArgs e)
        {
            // If our control is being removed
            if ((_dateTimePicker != null) && (e.Component == _dateTimePicker))
            {
                // Need access to host in order to delete a component
                IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));

                // We need to remove all the button spec instances
                for (int i = _dateTimePicker.ButtonSpecs.Count - 1; i >= 0; i--)
                {
                    // Get access to the indexed button spec
                    ButtonSpec spec = _dateTimePicker.ButtonSpecs[i];

                    // Must wrap button spec removal in change notifications
                    _changeService.OnComponentChanging(_dateTimePicker, null);

                    // Perform actual removal of button spec from textbox
                    _dateTimePicker.ButtonSpecs.Remove(spec);

                    // Get host to remove it from design time
                    host.DestroyComponent(spec);

                    // Must wrap button spec removal in change notifications
                    _changeService.OnComponentChanged(_dateTimePicker, null, null, null);
                }
            }
        }
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:28,代码来源:KryptonDateTimePickerColumnDesigner.cs

示例3: OnComponentAdded

 private void OnComponentAdded(object sender, ComponentEventArgs eventArgs)
 {
     IDesignerHost designerHost = (IDesignerHost)this.serviceProvider.GetService(typeof(IDesignerHost));
     if (designerHost != null)
     {
         if (designerHost.RootComponent == eventArgs.Component)
         {
             Activity rootActivity = designerHost.RootComponent as Activity;
             if (rootActivity != null)
             {
                 CompositeActivity compositeActivity = rootActivity as CompositeActivity;
                 if (compositeActivity != null)
                 {
                     if (this.ensureChildHierarchyHandler == null)
                     {
                         this.ensureChildHierarchyHandler = new EventHandler(OnEnsureChildHierarchy);
                         Application.Idle += this.ensureChildHierarchyHandler;
                     }
                 }
                 rootActivity.UserData[UserDataKeys.CustomActivity] = false;
             }
         }
         else if (eventArgs.Component is Activity)
         {
             if ((eventArgs.Component is CompositeActivity) && Helpers.IsCustomActivity(eventArgs.Component as CompositeActivity))
                 (eventArgs.Component as Activity).UserData[UserDataKeys.CustomActivity] = true;
             else
                 (eventArgs.Component as Activity).UserData[UserDataKeys.CustomActivity] = false;
         }
     }
 }
开发者ID:uQr,项目名称:referencesource,代码行数:31,代码来源:CustomActivityDesigner.cs

示例4: OnComponentRemoved

 protected virtual void OnComponentRemoved(ComponentEventArgs e)
 {
     if (this.ComponentRemoved != null)
     {
         this.ComponentRemoved(this, e);
     }
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:7,代码来源:Category.cs

示例5: DataSource_ComponentRemoved

 private void DataSource_ComponentRemoved(object sender, ComponentEventArgs e)
 {
     DataGrid component = (DataGrid) base.Component;
     if (e.Component == component.DataSource)
     {
         component.DataSource = null;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:DataGridDesigner.cs

示例6: OnComponentRemoving

		private void OnComponentRemoving (object sender, ComponentEventArgs args)
		{
			if (this.GetComponentSelected (args.Component))
#if NET_2_0
				this.SetSelectedComponents (new IComponent[] { args.Component }, SelectionTypes.Remove);
#else
				this.SetSelectedComponents (new IComponent[] { this.RootComponent }, SelectionTypes.Click);
#endif
		}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:SelectionService.cs

示例7: OnComponentRemoving

		private void OnComponentRemoving(object sender, ComponentEventArgs e)
		{
		    var control = e.Component as DockControl;
		    if (control?.LayoutSystem != null && control.LayoutSystem.DockContainer == _dockContainer)
		    {
		        _dockControl = control;
		        RaiseComponentChanging(TypeDescriptor.GetProperties(_dockContainer)["LayoutSystem"]);
		    }
		}
开发者ID:javagg,项目名称:DemoDock,代码行数:9,代码来源:DockContainerDesigner.cs

示例8: CategoryComponentRemoved

 private void CategoryComponentRemoved(object sender, ComponentEventArgs e)
 {
     this.RemoveComponent(e.Component);
     Category category = (Category) sender;
     if (!this.ComponentCategoryMap.ContainsValue(category))
     {
         category.ComponentAdded -= new ComponentEventHandler(this.CategoryComponentAdded);
         category.ComponentRemoved -= new ComponentEventHandler(this.CategoryComponentRemoved);
         category.Disposed -= new EventHandler(this.CategoryDisposed);
     }
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:11,代码来源:CategoryManager.cs

示例9: doComponentRemoving

 private void doComponentRemoving(object sender, ComponentEventArgs e)
 {
   if (e.Component is ModelBase)
   {
     RecordContextPanel ctl = Control as RecordContextPanel;
     if (ctl != null)
     {
       if (e.Component == ctl.AttachToRecord) ctl.AttachToRecord = null;
      
     }
   }
 }
开发者ID:vlapchenko,项目名称:nfx,代码行数:12,代码来源:RecordContextDesignClasses.cs

示例10: doComponentRemoving

 private void doComponentRemoving(object sender, ComponentEventArgs e)
 {
   if (e.Component is ModelBase)
   {
     FieldContextControl ctl = Control as FieldContextControl;
     if (ctl!=null)
     {
       if (e.Component == ctl.AttachToRecord) ctl.AttachToRecord = null;
        else
         if (e.Component == ctl.AttachToField) ctl.AttachToField = null;
     }
   }
 }
开发者ID:vlapchenko,项目名称:nfx,代码行数:13,代码来源:FieldContextDesignClasses.cs

示例11: OnComponentRemoving

		private void OnComponentRemoving(object sender,ComponentEventArgs e)
		{
			
			if(e.Component!=this.Component)
			{
				return;
			}

            DockSite c = this.Control as DockSite;
            if (c.Dock != DockStyle.Fill && !DotNetBarManagerRemoving)
            {
                throw new InvalidOperationException("DotNetBarManager dock sites must not be removed manually. Delete DotNetBarManager component to remove all dock sites.");
            }
            else
            {
                IDesignerHost dh = (IDesignerHost)GetService(typeof(IDesignerHost));
                if (dh != null)
                {
                    Bar[] bars = new Bar[c.Controls.Count];
                    c.Controls.CopyTo(bars, 0);
                    foreach (Bar bar in bars)
                    {
                        if (bar != null)
                        {
                            dh.DestroyComponent(bar);
                        }
                    }
                }
            }

			// Unhook events
			IComponentChangeService cc=(IComponentChangeService)GetService(typeof(IComponentChangeService));
			if(cc!=null)
				cc.ComponentRemoving-=new ComponentEventHandler(this.OnComponentRemoving);
			
			if(c==null)
				return;
			if(c.Owner!=null)
			{
				if(c.Owner.FillDockSite==c)
					c.Owner.FillDockSite=null;
				else if(c.Owner.LeftDockSite==c)
					c.Owner.LeftDockSite=null;
				else if(c.Owner.RightDockSite==c)
					c.Owner.RightDockSite=null;
				else if(c.Owner.TopDockSite==c)
					c.Owner.TopDockSite=null;
				else if(c.Owner.BottomDockSite==c)
					c.Owner.BottomDockSite=null;
			}
		}
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:51,代码来源:DockSiteDesigner.cs

示例12: OnComponentRemoved

        private void OnComponentRemoved(object sender, ComponentEventArgs e)
        {
            if (e.Component is WizardPage)
            {
                WizardPage page = e.Component as WizardPage;
                Wizard w = this.Control as Wizard;

                if (page != null && w.WizardPages.Contains(page))
                {
                    IComponentChangeService cc = this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
                    if (cc != null)
                        cc.OnComponentChanging(w, TypeDescriptor.GetProperties(w)["WizardPages"]);

                    w.WizardPages.Remove(page);

                    if (cc != null)
                        cc.OnComponentChanged(w, TypeDescriptor.GetProperties(w)["WizardPages"], null, null);
                }
            }
        }
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:20,代码来源:WizardDesigner.cs

示例13: OnComponentRemoving

 private void OnComponentRemoving(object sender, ComponentEventArgs e)
 {
     BindingSource component = base.Component as BindingSource;
     if ((component != null) && (component.DataSource == e.Component))
     {
         IComponentChangeService service = (IComponentChangeService) this.GetService(typeof(IComponentChangeService));
         string dataMember = component.DataMember;
         PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(component);
         PropertyDescriptor member = (properties != null) ? properties["DataMember"] : null;
         if ((service != null) && (member != null))
         {
             service.OnComponentChanging(component, member);
         }
         component.DataSource = null;
         if ((service != null) && (member != null))
         {
             service.OnComponentChanged(component, member, dataMember, "");
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:20,代码来源:BindingSourceDesigner.cs

示例14: OnComponentRemoved

        private void OnComponentRemoved(object sender, ComponentEventArgs e)
        {
            if (e.Component is PageSliderPage)
            {
                PageSliderPage page = e.Component as PageSliderPage;
                PageSlider slider = this.Control as PageSlider;

                if (page != null && slider.Controls.Contains(page))
                {
                    IComponentChangeService cc = this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
                    if (cc != null)
                        cc.OnComponentChanging(slider, TypeDescriptor.GetProperties(slider)["Controls"]);

                    slider.Controls.Remove(page);

                    if (cc != null)
                        cc.OnComponentChanged(slider, TypeDescriptor.GetProperties(slider)["Controls"], null, null);
                }
            }
        }
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:20,代码来源:PageSliderDesigner.cs

示例15: OnComponentRemoving

        /// <summary>
        /// Occurs when the component is being removed from the designer.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">A ComponentEventArgs containing event data.</param>
        protected override void OnComponentRemoving(object sender, ComponentEventArgs e)
        {
            // If our control is being removed
            if (e.Component == Navigator)
            {
                // If this workspace cell is inside a parent
                KryptonWorkspaceCell cell = (KryptonWorkspaceCell)Navigator;
                if (cell.WorkspaceParent != null)
                {
                    // Cell an only be inside a workspace sequence
                    KryptonWorkspaceSequence sequence = (KryptonWorkspaceSequence)cell.WorkspaceParent;
                    if (sequence != null)
                    {
                        // Remove the cell from the parent
                        sequence.Children.Remove(cell);
                    }
                }
            }

            base.OnComponentRemoving(sender, e);
        }
开发者ID:ComponentFactory,项目名称:Krypton,代码行数:26,代码来源:KryptonWorkspaceCellDesigner.cs


注:本文中的System.ComponentModel.Design.ComponentEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。