protected override void Paint(PPaintContext paintContext)
            {
                float bx           = X;
                float by           = Y;
                float rightBorder  = bx + Width;
                float bottomBorder = by + Height;

                XnaGraphicsPath line = new XnaGraphicsPath();
                XnaGraphics     g    = paintContext.Graphics;

                System.Drawing.Color penColor = System.Drawing.Color.FromArgb(this.Brush.A, this.Brush.R, this.Brush.G, this.Brush.B);
                System.Drawing.Pen   pen      = new System.Drawing.Pen(penColor, 0);

                // draw vertical lines
                for (float x = bx; x < rightBorder; x += 5)
                {
                    line.Reset();
                    line.AddLine(x, by, x, bottomBorder);
                    g.DrawPath(pen, line);
                }

                for (float y = by; y < bottomBorder; y += 5)
                {
                    line.Reset();
                    line.AddLine(bx, y, rightBorder, y);
                    g.DrawPath(pen, line);
                }
            }
Example #2
0
 /// <summary>
 /// See <see cref="GraphicsPath.AddPath(GraphicsPath, bool)">GraphicsPath.AddPath</see>.
 /// </summary>
 public virtual void AddPath(XnaGraphicsPath path, bool connect)
 {
     this.path.AddPath(path, connect);
     FirePropertyChangedEvent(PROPERTY_KEY_PATH, PROPERTY_CODE_PATH, null, path);
     UpdateBoundsFromPath();
     InvalidatePaint();
 }
Example #3
0
        /// <summary>
        /// Sets the temp region to the transformed path, widening the path if
        /// requested to do so.
        /// </summary>
        private void SetTempRegion(XnaGraphicsPath path, Matrix matrix, bool widen)
        {
            TEMP_PATH.Reset();

            if (path.PointCount > 0)
            {
                TEMP_PATH.AddPath(path, false);

                if (widen)
                {
                    TEMP_PATH.Widen(pen, matrix);
                }
                else
                {
                    TEMP_PATH.Transform(matrix);
                }
            }

            //TEMP_REGION.MakeInfinite();
            //TEMP_REGION.Intersect(TEMP_PATH);
        }
Example #4
0
        //****************************************************************
        // Bounds - Methods for manipulating/updating the bounds of a
        // PPath.
        //****************************************************************

        /// <summary>
        /// Overridden.  See <see cref="PNode.StartResizeBounds">PNode.StartResizeBounds</see>.
        /// </summary>
        public override void StartResizeBounds()
        {
            resizePath = new XnaGraphicsPath();
            resizePath.AddPath(path, false);
        }
Example #5
0
 /// <summary>
 /// Overridden.  See <see cref="PNode.EndResizeBounds">PNode.EndResizeBounds</see>.
 /// </summary>
 public override void EndResizeBounds()
 {
     resizePath = null;
 }
Example #6
0
 /// <summary>
 /// Constructs a new PPath with the given points, point types, fill mode and pen.
 /// </summary>
 /// <param name="pts">The points in the path.</param>
 /// <param name="types">The types of the points in the path.</param>
 /// <param name="fillMode">The fill mode to use when rendering this node.</param>
 /// <param name="pen">The pen to use when rendering this node.</param>
 public PPath(PointFx[] pts, PathPointType[] types, System.Drawing.Drawing2D.FillMode fillMode, System.Drawing.Pen pen)
 {
     path     = new XnaGraphicsPath(pts, types, fillMode);
     this.pen = pen;
     UpdateBoundsFromPath();
 }
Example #7
0
 /// <summary>
 /// Constructs a new PPath wrapping the given
 /// <see cref="System.Drawing.Drawing2D.GraphicsPath">
 /// System.Drawing.Drawing2D.GraphicsPath</see>.
 /// </summary>
 /// <param name="path">The path to wrap.</param>
 public PPath(XnaGraphicsPath path)
 {
     pen       = DEFAULT_PEN;
     this.path = (XnaGraphicsPath)path.Clone();
     UpdateBoundsFromPath();
 }
Example #8
0
 /// <summary>
 /// Constructs a new PPath with an empty path.
 /// </summary>
 public PPath()
 {
     pen  = DEFAULT_PEN;
     path = new XnaGraphicsPath();
 }
Example #9
0
 /// <summary>
 /// Constructs a new P3DRectangle with empty bounds.
 /// </summary>
 public P3DRectangle()
 {
     raised = true;
     pen    = new System.Drawing.Pen(System.Drawing.Brushes.Black, 0);
     path   = new XnaGraphicsPath();
 }
Example #10
0
 /// <summary>
 /// Returns true if the interior of the given path intersects the given rectangle.
 /// </summary>
 /// <param name="path">The path to check for intersection.</param>
 /// <param name="rect">The rectangle to check for intersection.</param>
 /// <returns>
 /// True if the interior of the given path intersects the given rectangle; otherwise,
 /// false.
 /// </returns>
 public static bool PathIntersectsRect(XnaGraphicsPath path, RectangleFx rect)
 {
     TEMP_REGION.MakeInfinite();
     TEMP_REGION.Intersect(path);
     return(TEMP_REGION.IsVisible(rect.ToRectangleF()));
 }