private void MouseMoveSetStartMovePoint(MouseEventArgs e) { if (this.leadLine != null) { UnitPoint mousePoint = this.GetMousePoint(); Rectangle invalidaterect = ScreenUtils.ConvertRectangle(ScreenUtils.ToScreenNormalized(this.canvasWrapper, this.leadLine.GetBoundingRectangle(BoundingRectangleType.Drawing))); invalidaterect.Inflate(2, 2); RepaintStatic(invalidaterect); this.leadLine.OnMouseMove(mousePoint); CanvasWrapper canvasWrapper = new CanvasWrapper(this, Graphics.FromHwnd(this.Handle), this.ClientRectangle); RectangleF invalidateRect = ScreenUtils.ConvertRectangle(ScreenUtils.ToScreenNormalized(this.canvasWrapper, this.leadLine.GetBoundingRectangle(BoundingRectangleType.Drawing))); this.leadLine.Draw(canvasWrapper, invalidateRect); canvasWrapper.Graphics.Dispose(); canvasWrapper.Dispose(); } }
private void MouseMoveSetBridge(MouseEventArgs e) { if (!this.bridgeStart.IsEmpty) { UnitPoint mousePoint = this.GetMousePoint(); Rectangle invalidaterect = ScreenUtils.ConvertRectangle(ScreenUtils.ToScreenNormalized(this.canvasWrapper, ScreenUtils.GetRectangleF(this.bridgeStart, this.bridgeEnd, UCCanvas.GetThresholdWidth() / 2))); invalidaterect.Inflate(2, 2); RepaintStatic(invalidaterect); this.bridgeEnd = mousePoint; CanvasWrapper canvasWrapper = new CanvasWrapper(this, Graphics.FromHwnd(this.Handle), this.ClientRectangle); Pen pen = new Pen(Color.Bisque, 1) { DashStyle = DashStyle.Custom, DashPattern = new float[2] { 2, 3 } }; canvasWrapper.DrawLine(canvasWrapper, pen, this.bridgeStart, this.bridgeEnd); canvasWrapper.Graphics.Dispose(); canvasWrapper.Dispose(); } }