private void hosting_InitFormElementsComponentComplete(FormDesignSurfaceHosting hosting) { if (HostingInitFormElementsComponentComplete != null) { HostingInitFormElementsComponentComplete(hosting); } }
/// <summary> /// 更新属性网格选定的对象 /// </summary> private void UpdateSelection(FormDesignSurfaceHosting hosting) { //这里不能直接这样写==null,省下面两个else //这样写的结果是切换选择的对象时,PropertyGrid中间都会经历一次没有选择的状态 //使行共享功能完全失效! //this.SelectedObject = null; if (hosting != null && hosting.SelectionService != null) { ICollection selection = hosting.SelectionService.GetSelectedComponents(); if (selection != null) { object[] selArray = new object[selection.Count]; selection.CopyTo(selArray, 0); this.SelectedObjects = selArray; } else { this.SelectedObject = null; } } else { this.SelectedObject = null; } }
void _container_HostingInitFormElementsComponentComplete(FormDesignSurfaceHosting hosting) { if (hosting == _container.ActiveHosting) { UpdateStatus(hosting); } }
public void Create(WindowEntity formEntity) { //不能在FormDesignSurfaceHosting的VisibleChanged事件中,设置当前活动设计器或撤销重做引擎这些当前对象 //在多个设计窗体切换时,要显示的窗体的Visible=true,然后被切掉的窗体才Visible=false,永远走到false里去 if (OnDesign(formEntity.Id)) { //激活 foreach (IDockContent dockContent in this.dockPanel.Documents) { FormDesignSurfaceHosting hosting = dockContent as FormDesignSurfaceHosting; if (hosting.WindowEntity.Id == formEntity.Id) { dockContent.DockHandler.Activate(); } } } else { //创建新的设计器容器 FormDesignSurfaceHosting hosting = new FormDesignSurfaceHosting(formEntity, this._designSurfaceManager.NewDesignSurface(), this); hosting.SelectionService.SelectionChanged += new EventHandler(SelectionService_SelectionChanged); hosting.InitFormElementsComponentComplete += new FormDesignSurfaceHosting.OnInitFormElementsComponentCompleteHandler(hosting_InitFormElementsComponentComplete); hosting.DockAreas = DockAreas.Document; hosting.Show(this.dockPanel); } }
private void _container_ActiveHostingChanged(FormDesignSurfaceHosting hosting) { if (hosting != null) { this.Toolbox.DesignerHost = hosting.DesignerHost; } else { this.Toolbox.DesignerHost = null; } }
/// <summary> /// 判断指定ID的窗体实体对象是否处于设计中 /// </summary> /// <param name="id"></param> /// <returns></returns> public bool OnDesign(string id) { foreach (IDockContent dockContent in this.dockPanel.Documents) { FormDesignSurfaceHosting hosting = dockContent as FormDesignSurfaceHosting; if (hosting.WindowEntity.Id == id) { return(true); } } return(false); }
/// <summary> /// 更新/设置属性面板窗体 /// </summary> private void UpdateStatus(FormDesignSurfaceHosting hosting) { if (hosting != null && hosting.DesignerHost != null) { this.Host = hosting.DesignerHost; this.SelectableObjects = hosting.DesignerHost.Container.Components; } else { this.Host = null; this.SelectableObjects = null; } UpdateSelection(hosting); }
private void UpdateSelection(FormDesignSurfaceHosting hosting) { if (hosting == null || hosting.SelectionService == null) { this.Entity = null; return; } ICollection selection = hosting.SelectionService.GetSelectedComponents(); if (selection != null && selection.Count == 1) { object[] selArray = new object[selection.Count]; selection.CopyTo(selArray, 0); IShellControlDev shellControlDev = selArray[0] as IShellControlDev; if (shellControlDev != null) { this.Entity = shellControlDev.Entity; } } else { this.Entity = null; } }
void _container_ActiveHostingChanged(FormDesignSurfaceHosting hosting) { UpdateStatus(hosting); }
void _container_HostingSelectionChanged(FormDesignSurfaceHosting hosting) { UpdateSelection(hosting); }
private void _container_ActiveHostingChanged(FormDesignSurfaceHosting hosting) { UpdateSelection(hosting); }