當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。