/// <summary> /// /// </summary> /// <param name="e"></param> void IMouseEventReceiver.MouseUp(System.Windows.Forms.MouseEventArgs e) { if (this.Active && this.drawing) { System.Drawing.Point ptCur = new System.Drawing.Point(e.X, e.Y); System.Drawing.Rectangle rcDevice; if (this.dragSize) { rcDevice = Geometry.CreateRect(this.startingPoint, ptCur); } else { int trackingWidth = this.trackingRect.Width; int trackingHeight = this.trackingRect.Height; int trackingLeft = ptCur.X - (trackingWidth / 2); int trackingTop = ptCur.Y - (trackingHeight / 2); rcDevice = new System.Drawing.Rectangle(trackingLeft, trackingTop, trackingWidth, trackingHeight); } if (this.Bitmap != null) { RectangleF rcWorld = Controller.View.ViewToWorld(Controller.View.DeviceToView(rcDevice)); BitmapNode BitmapNode = new BitmapNode(this.bitmap, rcWorld); InsertNodesCmd cmd = new InsertNodesCmd(); cmd.Nodes.Add(BitmapNode); this.Controller.ExecuteCommand(cmd); } this.Controller.DeactivateTool(this); } }
/// <summary> /// /// </summary> protected override void OnComplete() { Syncfusion.Windows.Forms.Diagram.RoundRect shape = new Syncfusion.Windows.Forms.Diagram.RoundRect(this.rect); InsertNodesCmd cmd = new InsertNodesCmd(); cmd.Nodes.Add(shape); this.Controller.ExecuteCommand(cmd); }
/// <summary> /// /// </summary> void IClickEventReceiver.DoubleClick() { if (this.Active && this.drawing) { Point[] devicePts = (Point[])this.points.ToArray(typeof(Point)); PointF[] viewPts; PointF[] worldPts; Controller.View.DeviceToView(devicePts, out viewPts); Controller.View.ViewToWorld(viewPts, out worldPts); Syncfusion.Windows.Forms.Diagram.Polygon polygonShape = new Syncfusion.Windows.Forms.Diagram.Polygon(worldPts); InsertNodesCmd cmd = new InsertNodesCmd(); cmd.Nodes.Add(polygonShape); this.Controller.ExecuteCommand(cmd); this.Controller.DeactivateTool(this); } }
/// <summary> /// /// </summary> /// <param name="e"></param> void IMouseEventReceiver.MouseUp(System.Windows.Forms.MouseEventArgs e) { if (this.Active && this.drawing) { System.Drawing.Point ptEnd = this.Controller.View.SnapPointToGrid(e.X, e.Y); Point[] devicePts = { this.startingPoint, ptEnd }; PointF[] viewPts; PointF[] worldPts; Controller.View.DeviceToView(devicePts, out viewPts); Controller.View.ViewToWorld(viewPts, out worldPts); Syncfusion.Windows.Forms.Diagram.OrthogonalLine shape = new Syncfusion.Windows.Forms.Diagram.OrthogonalLine(worldPts[0], worldPts[1]); InsertNodesCmd cmd = new InsertNodesCmd(); cmd.Nodes.Add(shape); this.Controller.ExecuteCommand(cmd); this.Controller.DeactivateTool(this); } }
/// <summary> /// /// </summary> /// <param name="e"></param> void IMouseEventReceiver.MouseUp(System.Windows.Forms.MouseEventArgs e) { if (this.Active && this.drawing) { System.Drawing.Point pt = this.Controller.View.SnapPointToGrid(e.X, e.Y); Point[] devicePts = { pt }; PointF[] viewPts; PointF[] worldPts; Controller.View.DeviceToView(devicePts, out viewPts); Controller.View.ViewToWorld(viewPts, out worldPts); Syncfusion.Windows.Forms.Diagram.CirclePort port = new Syncfusion.Windows.Forms.Diagram.CirclePort(worldPts[0]); InsertNodesCmd cmd = new InsertNodesCmd(); cmd.Nodes.Add(port); this.Controller.ExecuteCommand(cmd); this.Controller.DeactivateTool(this); } }
/// <summary> /// /// </summary> /// <param name="e"></param> void IMouseEventReceiver.MouseDown(System.Windows.Forms.MouseEventArgs e) { if (this.Active && e.Button == MouseButtons.Left) { System.Drawing.Point devInsPt = new System.Drawing.Point(e.X, e.Y); System.Drawing.PointF worldInsPt = this.View.ViewToWorld(this.View.DeviceToView(devInsPt)); worldInsPt.X = worldInsPt.X - (this.symbol.Width / 2.0f); worldInsPt.Y = worldInsPt.Y - (this.symbol.Height / 2.0f); if (this.tracker != null) { this.tracker.Erase(); this.tracker = null; } InsertNodesCmd insCmd = new InsertNodesCmd(); insCmd.Nodes.Add(this.symbol); insCmd.Location = worldInsPt; this.Controller.ExecuteCommand(insCmd); this.Controller.DeactivateTool(this); } }
/// <summary> /// /// </summary> /// <param name="e"></param> void IMouseEventReceiver.MouseUp(System.Windows.Forms.MouseEventArgs e) { System.Drawing.Point pt = this.Controller.View.SnapPointToGrid(e.X, e.Y); if (this.Active && this.drawing) { this.drawing = false; System.Drawing.Rectangle rcBounds; float startAngle; float sweepAngle; Geometry.ArcFromPoints(this.startingPt, pt, out rcBounds, out startAngle, out sweepAngle); RectangleF rcWorld = Controller.View.ViewToWorld(Controller.View.DeviceToView(rcBounds)); Syncfusion.Windows.Forms.Diagram.Arc shape = new Syncfusion.Windows.Forms.Diagram.Arc(rcWorld, startAngle, sweepAngle); InsertNodesCmd cmd = new InsertNodesCmd(); cmd.Nodes.Add(shape); this.Controller.ExecuteCommand(cmd); this.Controller.DeactivateTool(this); } }
/// <summary> /// /// </summary> /// <param name="e"></param> void IMouseEventReceiver.MouseUp(System.Windows.Forms.MouseEventArgs e) { if (this.Active && this.drawing) { System.Drawing.Point ptEnd = new System.Drawing.Point(e.X, e.Y); int left = this.startingPoint.X; int top = this.startingPoint.Y; int width = e.X - left; int height = e.Y - top; if (width <= 0) { left = e.X; width = this.startingPoint.X - left; } if (height <= 0) { top = e.Y; height = this.startingPoint.Y - top; } Syncfusion.Windows.Forms.Diagram.TextNode textNode = new Syncfusion.Windows.Forms.Diagram.TextNode(this.defaultText); textNode.Location = new PointF(left, top); textNode.Size = new SizeF(width, height); InsertNodesCmd cmd = new InsertNodesCmd(); cmd.Nodes.Add(textNode); this.Controller.ExecuteCommand(cmd); this.Controller.EditText(textNode); this.Controller.DeactivateTool(this); } }