protected override void OnResizing(ActivityDesignerResizeEventArgs e) { if (this.AutoSize) { if (this.AutoSizeMode == System.Windows.Forms.AutoSizeMode.GrowOnly) { Rectangle enclosingRectangle = this.GetEnclosingRectangle(); if (!enclosingRectangle.IsEmpty) { Rectangle empty = Rectangle.Empty; empty.X = Math.Min(enclosingRectangle.Left, e.Bounds.Left); empty.Y = Math.Min(enclosingRectangle.Top, e.Bounds.Top); empty.Width = Math.Max((int)(enclosingRectangle.Right - empty.Left), (int)(e.Bounds.Right - empty.Left)); empty.Height = Math.Max((int)(enclosingRectangle.Bottom - empty.Top), (int)(e.Bounds.Bottom - empty.Top)); if (empty != e.Bounds) { e = new ActivityDesignerResizeEventArgs(e.SizingEdge, empty); } } } else { base.PerformLayout(); } } this.retainContainedDesignerLocations = true; base.OnResizing(e); this.retainContainedDesignerLocations = false; }
/// <summary> /// Called when the user is visually resizing the designer when designer is inside freeform designer /// </summary> /// <param name="e">ActivityDesignerResizeEventArgs specifying the edge being used to resize and new bounds</param> protected virtual void OnResizing(ActivityDesignerResizeEventArgs e) { FreeformActivityDesigner.SetDesignerBounds(this, e.Bounds); }
/// <summary> /// Called when the user starts to visually resize the designer when designer is inside freeform designer /// </summary> /// <param name="e"></param> protected virtual void OnBeginResizing(ActivityDesignerResizeEventArgs e) { }
protected override void OnResizing(ActivityDesignerResizeEventArgs e) { if (this.AutoSize) { if (this.AutoSizeMode == System.Windows.Forms.AutoSizeMode.GrowOnly) { Rectangle enclosingRectangle = this.GetEnclosingRectangle(); if (!enclosingRectangle.IsEmpty) { Rectangle empty = Rectangle.Empty; empty.X = Math.Min(enclosingRectangle.Left, e.Bounds.Left); empty.Y = Math.Min(enclosingRectangle.Top, e.Bounds.Top); empty.Width = Math.Max((int) (enclosingRectangle.Right - empty.Left), (int) (e.Bounds.Right - empty.Left)); empty.Height = Math.Max((int) (enclosingRectangle.Bottom - empty.Top), (int) (e.Bounds.Bottom - empty.Top)); if (empty != e.Bounds) { e = new ActivityDesignerResizeEventArgs(e.SizingEdge, empty); } } } else { base.PerformLayout(); } } this.retainContainedDesignerLocations = true; base.OnResizing(e); this.retainContainedDesignerLocations = false; }
protected override void OnResizing(ActivityDesignerResizeEventArgs e) { //If we are in AutoSize mode with grow and shrink option then dont allow resizing if (AutoSize) { if (AutoSizeMode == AutoSizeMode.GrowOnly) { Rectangle minRectangle = GetEnclosingRectangle(); if (!minRectangle.IsEmpty) { Rectangle bounds = Rectangle.Empty; bounds.X = Math.Min(minRectangle.Left, e.Bounds.Left); bounds.Y = Math.Min(minRectangle.Top, e.Bounds.Top); bounds.Width = Math.Max(minRectangle.Right - bounds.Left, e.Bounds.Right - bounds.Left); bounds.Height = Math.Max(minRectangle.Bottom - bounds.Top, e.Bounds.Bottom - bounds.Top); if (bounds != e.Bounds) e = new ActivityDesignerResizeEventArgs(e.SizingEdge, bounds); } } else { PerformLayout(); } } this.retainContainedDesignerLocations = true; base.OnResizing(e); this.retainContainedDesignerLocations = false; }