• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Design.ComponentEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ComponentChangeComponentAdded

        protected virtual void ComponentChangeComponentAdded(object sender, ComponentEventArgs e)
        {
            if (m_AddingItem)
            {
                m_AddingItem = false;
                IComponentChangeService cc = this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
                BaseItem parent = this.Component as BaseItem;

                if (cc != null)
                    cc.OnComponentChanging(parent, TypeDescriptor.GetProperties(parent)["SubItems"]);
                
                parent.SubItems.Add(e.Component as BaseItem);
                
                if (cc != null)
                    cc.OnComponentChanged(parent, TypeDescriptor.GetProperties(parent)["SubItems"], null, null);

                m_InsertItemTransaction.Commit();
                m_InsertItemTransaction = null;
                this.RecalcLayout();
            }
        }
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:21,代码来源:BaseItemDesigner.cs


示例17: ComponentRemoved

 private void ComponentRemoved(object sender, ComponentEventArgs e)
 {
     BaseItem item = e.Component as BaseItem;
     if (item != null)
     {
         BindingNavigatorEx navigator = (BindingNavigatorEx)base.Component;
         if (item == navigator.MoveFirstButton)
         {
             navigator.MoveFirstButton = null;
         }
         else if (item == navigator.MovePreviousButton)
         {
             navigator.MovePreviousButton = null;
         }
         else if (item == navigator.MoveNextButton)
         {
             navigator.MoveNextButton = null;
         }
         else if (item == navigator.MoveLastButton)
         {
             navigator.MoveLastButton = null;
         }
         else if (item == navigator.PositionTextBox)
         {
             navigator.PositionTextBox = null;
         }
         else if (item == navigator.CountLabel)
         {
             navigator.CountLabel = null;
         }
         else if (item == navigator.AddNewRecordButton)
         {
             navigator.AddNewRecordButton = null;
         }
         else if (item == navigator.DeleteButton)
         {
             navigator.DeleteButton = null;
         }
     }
 }
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:40,代码来源:BindingNavigatorExDesigner.cs


示例18: ComponentChangeSvc_ComponentRemoved

 private void ComponentChangeSvc_ComponentRemoved(object sender, ComponentEventArgs e)
 {
     ToolStripItem component = e.Component as ToolStripItem;
     if (component != null)
     {
         BindingNavigator navigator = (BindingNavigator) base.Component;
         if (component == navigator.MoveFirstItem)
         {
             navigator.MoveFirstItem = null;
         }
         else if (component == navigator.MovePreviousItem)
         {
             navigator.MovePreviousItem = null;
         }
         else if (component == navigator.MoveNextItem)
         {
             navigator.MoveNextItem = null;
         }
         else if (component == navigator.MoveLastItem)
         {
             navigator.MoveLastItem = null;
         }
         else if (component == navigator.PositionItem)
         {
             navigator.PositionItem = null;
         }
         else if (component == navigator.CountItem)
         {
             navigator.CountItem = null;
         }
         else if (component == navigator.AddNewItem)
         {
             navigator.AddNewItem = null;
         }
         else if (component == navigator.DeleteItem)
         {
             navigator.DeleteItem = null;
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:40,代码来源:BindingNavigatorDesigner.cs


示例19: OnComponentAdding

 private void OnComponentAdding(object sender, ComponentEventArgs eventArgs)
 {
     //We are adding root component, while doing this make sure that we provide the root designer attribute
     IDesignerHost designerHost = (IDesignerHost)this.serviceProvider.GetService(typeof(IDesignerHost));
     if (designerHost != null)
     {
         if (designerHost.RootComponent == null)
         {
             Activity rootActivity = eventArgs.Component as Activity;
             if (rootActivity != null)
             {
                 //Add root designer attribute
                 DesignerAttribute rootDesignerAttrib = GetDesignerAttribute(rootActivity, typeof(IRootDesigner));
                 if (rootDesignerAttrib.DesignerTypeName == typeof(ActivityDesigner).AssemblyQualifiedName)
                 {
                     DesignerAttribute designerAttrib = GetDesignerAttribute(rootActivity, typeof(IDesigner));
                     if (designerAttrib != null)
                         TypeDescriptor.AddAttributes(rootActivity, new Attribute[] { new DesignerAttribute(designerAttrib.DesignerTypeName, typeof(IRootDesigner)) });
                 }
             }
         }
     }
 }
开发者ID:uQr,项目名称:referencesource,代码行数:23,代码来源:CustomActivityDesigner.cs


示例20: ComponentContainerSetUp

		static void ComponentContainerSetUp(object sender, ComponentEventArgs e)
		{
			// HACK: This reflection mess fixes SD2-1374 and SD2-1375. However I am not sure why it is needed in the first place.
			// There seems to be a problem with the nested container class used
			// by the designer. It only establishes a connection to the service
			// provider of the DesignerHost after it has been queried for
			// an IServiceContainer service. This does not always happen
			// automatically, so we enforce that here. We have to use
			// reflection because the request for IServiceContainer is
			// not forwarded by higher-level GetService methods.
			// Also, be very careful when trying to troubleshoot this using
			// the debugger because it automatically gets all properties and
			// this can cause side effects here, such as initializing that service
			// so that the problem no longer appears.
			INestedContainer nestedContainer = e.Component.Site.GetService(typeof(INestedContainer)) as INestedContainer;
			if (nestedContainer != null) {
				MethodInfo getServiceMethod = nestedContainer.GetType().GetMethod("GetService", BindingFlags.Instance | BindingFlags.NonPublic, null, new [] {typeof(Type)}, null);
				if (getServiceMethod != null) {
					LoggingService.Debug("Forms designer: Initializing nested service container of " + e.Component.ToString() + " using Reflection");
					getServiceMethod.Invoke(nestedContainer, BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.NonPublic, null, new [] {typeof(IServiceContainer)}, null);
				}
			}
		}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:23,代码来源:AbstractCodeDomDesignerLoader.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Design.DesignSurface类代码示例发布时间:2022-05-26
下一篇:
C# Design.ComponentChangedEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap