static void FillInplaceHightlightRectangle(DrawContext ctx, RectangleF rect, Brush brush)
 {
     ctx.Canvas.PushState();
     ctx.Canvas.EnableAntialiasing(true);
     ctx.Canvas.FillRoundRectangle(brush, RectangleF.Inflate(rect, 2, 0), 3);
     ctx.Canvas.PopState();
 }
        public static System.Drawing.RectangleF Scale(this System.Drawing.RectangleF rect, float scale)
        {
            var size = new Vector2(rect.Width * scale, rect.Height * scale);

            rect.Inflate(size.X - rect.Width, size.Y - rect.Height);
            return(rect);
        }
        public virtual bool NotifyMouseMove(System.Windows.Forms.MouseEventArgs e)
        {
            if (e == null)
            {
                throw new System.ArgumentNullException("e");
            }

            if (_areaOriginDefined)
            {
                System.Drawing.RectangleF invalidationRect = System.Drawing.RectangleF.Empty;
                if (_areaDefined)
                {
                    invalidationRect = VObjectsUtils.GetBoundingRectangle(_cornerPoints);
                }

                _areaDefined     = true;
                _cornerPoints[1] = _objectHost.HostViewer.ControlToWorkspace(new System.Drawing.Point(e.X, e.Y), Aurigma.GraphicsMill.Unit.Point);

                invalidationRect = System.Drawing.RectangleF.Union(invalidationRect, VObjectsUtils.GetBoundingRectangle(_cornerPoints));
                invalidationRect.Inflate((int)_borderPen.Width * 2, (int)_borderPen.Width * 2);
                _objectHost.HostViewer.InvalidateViewer(new MultiLayerViewerInvalidationTarget(_objectHost.HostViewer.WorkspaceToControl(invalidationRect, Aurigma.GraphicsMill.Unit.Point)));
            }

            return(true);
        }
        protected void SwitchToDefaultDesigner()
        {
            System.Drawing.RectangleF invalidationRect = VObjectsUtils.GetBoundingRectangle(_cornerPoints);
            invalidationRect.Inflate((int)_borderPen.Width * 2, (int)_borderPen.Width * 2);
            _objectHost.HostViewer.InvalidateViewer(new MultiLayerViewerInvalidationTarget(_objectHost.HostViewer.WorkspaceToControl(invalidationRect, Aurigma.GraphicsMill.Unit.Point)));

            _objectHost.CurrentDesigner = _objectHost.DefaultDesigner;
        }
 public override void DrawRect(System.Drawing.RectangleF dirtyRect)
 {
     dirtyRect.Inflate(-1, -1);
     if (selected)
     {
         var color = NSColor.SelectedControl;
         color.Set();
         NSGraphics.RectFill(dirtyRect);
     }
 }
示例#6
0
 public RectangleFx Inflate(float x, float y)
 {
     System.Drawing.RectangleF rect = this.ToRectangleF();
     rect.Inflate(x, y);
     this.Min.X = rect.X;
     this.Min.Y = rect.Y;
     this.Max.X = rect.X + rect.Width;
     this.Max.Y = rect.Y + rect.Height;
     return(this);
 }
        protected override System.Drawing.Rectangle GetInvalidationRectangle()
        {
            System.Drawing.Rectangle result = System.Drawing.Rectangle.Empty;
            if (_dragging)
            {
                System.Drawing.RectangleF rect = GetWorkspaceRectangle();
                if (base.Pen != null)
                {
                    rect.Inflate(base.Pen.Width * 2, base.Pen.Width * 2);
                }

                result = base.VObjectHost.HostViewer.WorkspaceToControl(rect, Aurigma.GraphicsMill.Unit.Point);
                result.Inflate(VObject.InvalidationMargin.Width, VObject.InvalidationMargin.Width);
            }

            return(result);
        }
示例#8
0
        private static void RenderShape(GH_Canvas canvas, System.Drawing.Graphics graphics, System.Drawing.PointF[] points, System.Drawing.Color color)
        {
            int   alpha    = GH_Canvas.ZoomFadeMedium;
            float x0       = points[0].X;
            float x        = x0;
            float y0       = points[0].Y;
            float y        = y0;
            int   arg_32_0 = 1;
            int   num      = points.Length - 1;

            for (int i = arg_32_0; i <= num; i++)
            {
                x0 = System.Math.Min(x0, points[i].X);
                x  = System.Math.Max(x, points[i].X);
                y0 = System.Math.Min(y0, points[i].Y);
                y  = System.Math.Max(y, points[i].Y);
            }
            System.Drawing.RectangleF bounds = System.Drawing.RectangleF.FromLTRB(x0, y0, x, y);
            bounds.Inflate(1f, 1f);
            System.Drawing.Drawing2D.LinearGradientBrush fill = new System.Drawing.Drawing2D.LinearGradientBrush(bounds, color, GH_GraphicsUtil.OffsetColour(color, 50), System.Drawing.Drawing2D.LinearGradientMode.Vertical);
            fill.WrapMode = System.Drawing.Drawing2D.WrapMode.TileFlipXY;
            graphics.FillPolygon(fill, points);
            fill.Dispose();
            if (alpha > 0)
            {
                System.Drawing.Color col0 = System.Drawing.Color.FromArgb(System.Convert.ToInt32(0.5 * (double)alpha), System.Drawing.Color.White);
                System.Drawing.Color col  = System.Drawing.Color.FromArgb(0, System.Drawing.Color.White);
                System.Drawing.Drawing2D.LinearGradientBrush highlightFill = new System.Drawing.Drawing2D.LinearGradientBrush(bounds, col0, col, System.Drawing.Drawing2D.LinearGradientMode.Vertical);
                highlightFill.WrapMode = System.Drawing.Drawing2D.WrapMode.TileFlipXY;
                System.Drawing.Pen highlightEdge = new System.Drawing.Pen(highlightFill, 3f);
                highlightEdge.LineJoin      = System.Drawing.Drawing2D.LineJoin.Round;
                highlightEdge.CompoundArray = new float[]
                {
                    0f,
                    0.5f
                };
                graphics.DrawPolygon(highlightEdge, points);
                highlightFill.Dispose();
                highlightEdge.Dispose();
            }
            graphics.DrawPolygon(new System.Drawing.Pen(color, 1f)
            {
                LineJoin = System.Drawing.Drawing2D.LineJoin.Round
            }, points);
        }
        public override bool NotifyMouseMove(System.Windows.Forms.MouseEventArgs e)
        {
            if (_dragging)
            {
                System.Drawing.PointF[] points = new System.Drawing.PointF[3];
                points[0] = _point0;
                points[1] = _point1;

                _point1   = base.VObjectHost.HostViewer.ControlToWorkspace(new System.Drawing.Point(e.X, e.Y), Aurigma.GraphicsMill.Unit.Point);
                points[2] = _point1;

                System.Drawing.RectangleF workspaceChangedRect = VObjectsUtils.GetBoundingRectangle(points);
                if (base.Pen != null)
                {
                    workspaceChangedRect.Inflate(base.Pen.Width * 2, base.Pen.Width * 2);
                }

                System.Drawing.Rectangle invalidationRect = base.VObjectHost.HostViewer.WorkspaceToControl(workspaceChangedRect, Aurigma.GraphicsMill.Unit.Point);
                invalidationRect.Inflate(VObject.InvalidationMargin);
                base.VObjectHost.HostViewer.InvalidateViewer(new MultiLayerViewerInvalidationTarget(invalidationRect));
            }

            return(base.NotifyMouseMove(e));
        }
示例#10
0
 /// <summary>
 /// Gets a rectangle centered on the given point and inflated in the x and y directions
 /// by the given amounts.
 /// </summary>
 /// <param name="aCenterPoint">The center point for the inflated rectangle.</param>
 /// <param name="inflateX">
 /// The amount to inflate the rectangle in the x direction.
 /// </param>
 /// <param name="inflateY">
 /// The amount to inflate the rectangle in the y direction.
 /// </param>
 /// <returns>The inflated rectangle.</returns>
 public static RectangleFx InflatedRectangle(PointFx aCenterPoint, float inflateX, float inflateY)
 {
     System.Drawing.RectangleF r = new System.Drawing.RectangleF(aCenterPoint.X, aCenterPoint.Y, 0, 0);
     r.Inflate(inflateX, inflateY);
     return(RectangleFxtensions.ToRectangleFx(r));
 }