本文整理汇总了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);
}
}
}
示例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);
}
}
}
示例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;
}
}
}
示例4: OnComponentRemoved
protected virtual void OnComponentRemoved(ComponentEventArgs e)
{
if (this.ComponentRemoved != null)
{
this.ComponentRemoved(this, e);
}
}
示例5: DataSource_ComponentRemoved
private void DataSource_ComponentRemoved(object sender, ComponentEventArgs e)
{
DataGrid component = (DataGrid) base.Component;
if (e.Component == component.DataSource)
{
component.DataSource = null;
}
}
示例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
}
示例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"]);
}
}
示例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);
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
示例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);
}
}
}
示例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, "");
}
}
}
示例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);
}
}
}
示例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);
}