Ejemplo n.º 1
0
        public override void Draw(SpriteBatch g)
        {
            Rectangle r = GetNormalizedRectangle(Rectangle);

            if (Fill.ToColor() != Color.Transparent)
            {
                //Brush brush = new SolidBrush(Fill);
                XnaDrawing.DrawFilledEllipse(r, Fill.ToColor());
            }
            //var pen = new Pen(Stroke, StrokeWidth);
            XnaDrawing.DrawEllipse(r, Stroke);
            //pen.Dispose();
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  Draw group selection rectangle
        /// </summary>
        /// <param name="g"></param>
        public void DrawNetSelection()
        {
            if (!DrawNetRectangle)
            {
                return;
            }

            XnaDrawing.DrawRectangle(NetRectangle, Color.Black);

            //var r = new System.Drawing.Rectangle(Convert.ToInt32(NetRectangle.X), Convert.ToInt32(NetRectangle.Y),
            //    Convert.ToInt32(NetRectangle.Width), Convert.ToInt32(NetRectangle.Height));

            //ControlPaint.DrawFocusRectangle(g, r, System.Drawing.Color.Black, System.Drawing.Color.Transparent);
        }
Ejemplo n.º 3
0
 public override void Draw(SpriteBatch g)
 {
     try
     {
         //g.SmoothingMode = SmoothingMode.AntiAlias;
         //var pen = new Pen(Stroke, StrokeWidth);
         //TODO change DrawLine to include thickness
         XnaDrawing.DrawLine(2.0f, Stroke, new Vector2(_startPoint.X, _startPoint.Y), new Vector2(_endPoint.X, _endPoint.Y));
         //pen.Dispose();
     }
     catch (Exception ex)
     {
         ErrH.Log("DrawLine", "Draw", ex.ToString(), ErrH._LogPriority.Info);
     }
 }
Ejemplo n.º 4
0
        public override void Draw(SpriteBatch g)
        {
            float x1 = 0, y1 = 0;     // previous point

            try
            {
                //g.SmoothingMode = SmoothingMode.AntiAlias;

                if (Fill.ToColor() != Color.Transparent)
                {
                    var arr = new Vector2[_pointArray.Count];
                    for (int i = 0; i < _pointArray.Count; i++)
                    {
                        arr[i] = (Vector2)_pointArray[i];
                    }
                    //Brush brush = new SolidBrush(Fill);
                    XnaDrawing.DrawPolyline(arr, Fill.ToColor());
                }

                //var pen = new Pen(Stroke, StrokeWidth);

                IEnumerator enumerator = _pointArray.GetEnumerator();

                if (enumerator.MoveNext())
                {
                    x1 = ((Point)enumerator.Current).X;
                    y1 = ((Point)enumerator.Current).Y;
                }

                while (enumerator.MoveNext())
                {
                    float x2 = ((Point)enumerator.Current).X;             // current point
                    float y2 = ((Point)enumerator.Current).Y;             // current point

                    XnaDrawing.DrawLine(2.0f, Stroke, new Vector2(x1, y1), new Vector2(x2, y2));

                    x1 = x2;
                    y1 = y2;
                }

                //pen.Dispose();
            }
            catch (Exception ex)
            {
                ErrH.Log("DrawPolygon", "Draw", ex.ToString(), ErrH._LogPriority.Info);
            }
        }
Ejemplo n.º 5
0
 public override void Draw(SpriteBatch g)
 {
     //SpriteFont font = null;
     if (Font == null)
     {
         Font = XnaDrawing.defaultFont;
     }
     if (Rectangle.Width == 0 || Rectangle.Height == 0)
     {
         Rectangle = CalcSize(Text, Font, Rectangle.X, Rectangle.Y, TextAnchor);
     }
     //Brush brush = new SolidBrush(Stroke);
     try
     {
         XnaDrawing.DrawText(Font, Text, Stroke, Rectangle, TextAnchor);
     }
     catch (Exception ex)
     {
         ErrH.Log("DrawText", "Draw", ex.ToString(), ErrH._LogPriority.Info);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Draw rectangle
        /// </summary>
        /// <param name="g"></param>
        public override void Draw(SpriteBatch g)
        {
            try
            {
                Rectangle r = GetNormalizedRectangle(Rectangle);
                if (Fill.ToColor() != Color.Transparent)
                {
                    //Brush brush = new SolidBrush(Fill);
                    XnaDrawing.DrawFilledRectangle(r, Fill.ToColor());
                }
                //Pen pen = new Pen(Stroke, StrokeWidth);
                //TODO change Draw Rectangle to include strokewidth
                XnaDrawing.DrawRectangle(r, Stroke);

                //pen.Dispose();
            }
            catch (Exception ex)
            {
                ErrH.Log("DrawRectangle", "Draw", ex.ToString(), ErrH._LogPriority.Info);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Draw tracker for selected object
        /// </summary>
        /// <param name="g"></param>
        public virtual void DrawTracker(SpriteBatch g)
        {
            if (!Selected)
            {
                return;
            }

            //var brush = new SolidBrush(Color.Black);

            for (int i = 1; i <= HandleCount; i++)
            {
                try
                {
                    XnaDrawing.DrawFilledRectangle(GetHandleRectangle(i), Color.Black);
                }
                catch
                {}
            }

            //brush.Dispose();
        }