private void resizerControl_SizerModeChanged(SizerHandle handle, SizerMode mode) { SuspendLayout(); if (mode == SizerMode.Normal) { //trim the padding of the behavior for drawing the sizers OnResizeEnd(_resizerControl.SizerSize); _dragBufferControl.Visible = false; SynchronizeResizerWithElement(); } else { //notify subclasses that a resize action has been initiated bool preserveAspectRatio = handle == SizerHandle.TopLeft || handle == SizerHandle.TopRight || handle == SizerHandle.BottomLeft || handle == SizerHandle.BottomRight; OnResizeStart(ElementRectangle.Size, preserveAspectRatio); //expand the padding of the behavior region to the whole body so that the resizer //can have the freedom to paint anywhere in the document. This is important //since the resizer handles may be placed well outside of the element bounds depending //on which sizer handle was grabbed and how the element is anchored. Rectangle rect = CalculateElementRectangleRelativeToBody(HTMLElement); IHTMLElement body = (HTMLElement.document as IHTMLDocument2).body; _dragBufferControl.VirtualSize = new Size(body.offsetWidth, body.offsetHeight); _dragBufferControl.VirtualLocation = new Point(-rect.X, -rect.Y); _dragBufferControl.Visible = true; } ResumeLayout(); PerformLayout(); Invalidate(); }
protected virtual void OnSizerModeChanged(SizerHandle handle, SizerMode mode) { bool resizeStarted = _mode == SizerMode.Normal && mode == SizerMode.Resizing; ActiveHandle = handle; _mode = mode; if (resizeStarted) { OnResizeStart(); } if (SizerModeChanged != null) { SizerModeChanged(handle, mode); } }
protected virtual void OnSizerModeChanged(SizerHandle handle, SizerMode mode) { bool resizeStarted = _mode == SizerMode.Normal && mode == SizerMode.Resizing; ActiveHandle = handle; _mode = mode; if (resizeStarted) OnResizeStart(); if (SizerModeChanged != null) SizerModeChanged(handle, mode); }