예제 #1
0
        public static void DrawCircleNode(ICanvas canvas, UnitPoint unitPoint)
        {
            RectangleF rectangleF = new RectangleF(canvas.ToScreen(unitPoint), new SizeF(0, 0));

            rectangleF.Inflate(4, 4);
            canvas.Graphics.FillEllipse(Brushes.Yellow, rectangleF);
            rectangleF.Inflate(1, 1);
            canvas.Graphics.DrawRectangle(Pens.Black, ScreenUtils.ConvertRectangle(rectangleF));
        }
예제 #2
0
 public static void DrawMicroFlag(ICanvas canvas, List <UnitPoint> microStartPoints)
 {
     if (microStartPoints != null)
     {
         microStartPoints.ForEach((start) =>
         {
             RectangleF rectangleF = new RectangleF(canvas.ToScreen(start), new SizeF(0, 0));
             rectangleF.Inflate(2.5f, 2.5f);
             canvas.Graphics.DrawRectangle(Pens.White, ScreenUtils.ConvertRectangle(rectangleF));
         });
     }
 }
예제 #3
0
        protected void DrawPoint(ICanvas canvas, Pen pen, Brush brush)
        {
            Rectangle screenRectangle = ScreenUtils.ConvertRectangle(ScreenUtils.ToScreenNormalized(canvas, this.boundingRectangle));

            canvas.Graphics.DrawRectangle(pen, screenRectangle);
            screenRectangle.X++;
            screenRectangle.Y++;
            screenRectangle.Width--;
            screenRectangle.Height--;
            if (brush != null)
            {
                canvas.Graphics.FillRectangle(brush, screenRectangle);
            }
        }
예제 #4
0
        public static void DrawNode(ICanvas canvas, UnitPoint unitPoint)
        {
            RectangleF rectangleF = new RectangleF(canvas.ToScreen(unitPoint), new SizeF(0, 0));

            rectangleF.Inflate(4, 4);
            if (rectangleF.Right < 0 || rectangleF.Left > canvas.ClientRectangle.Width)
            {
                return;
            }
            if (rectangleF.Top < 0 || rectangleF.Bottom > canvas.ClientRectangle.Height)
            {
                return;
            }
            canvas.Graphics.FillRectangle(Brushes.Yellow, rectangleF);
            rectangleF.Inflate(1, 1);
            canvas.Graphics.DrawRectangle(Pens.Black, ScreenUtils.ConvertRectangle(rectangleF));
        }
        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();
            }
        }
예제 #6
0
 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();
     }
 }