private void OnViewPropertyChanged(object sender, ApplicationSharingViewPropertyChangedEventArgs e) { ApplicationSharingView view = (ApplicationSharingView)sender; if (view.Properties == null) { return; } //If the changed viewer property is a dimension property then resize parent container control if (e.Property == ApplicationSharingViewProperty.Height || e.Property == ApplicationSharingViewProperty.Width) { //If user chose FitToParent, the parent container control is not resized. if (SharingModality.View.DisplayMode == ApplicationSharingViewDisplayMode.FitToParent) { return; } } else if (e.Property == ApplicationSharingViewProperty.ParentWindow) { if (SharingModality.View.State == ApplicationSharingViewState.Active) { SharingModality.View.SyncRectangle(); } } }
/// <summary> /// Sets dimensions for container control parent of application sharing view when the /// dimensions of the view change /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void View_PropertyChanged(object sender, ApplicationSharingViewPropertyChangedEventArgs e) { ApplicationSharingView view = (ApplicationSharingView)sender; if (view.Properties == null) { return; } //If the changed viewer property is a dimension property then resize parent container control if (e.Property == ApplicationSharingViewProperty.Height || e.Property == ApplicationSharingViewProperty.Width) { //If user chose FitToParent, the parent container control is not resized. if (_sharingModality.View.DisplayMode == ApplicationSharingViewDisplayMode.FitToParent) { this.Invoke(new NoParamDelegate(ResetFormToOriginalDimensions)); return; } this.Invoke( new ResizeFormForPanelDelegate(ResizeFormForPanel), new object[] { view }); } else if (e.Property == ApplicationSharingViewProperty.ParentWindow) { if (_sharingModality.View.State == ApplicationSharingViewState.Active) { _sharingModality.View.SyncRectangle(); } } }