예제 #1
0
        /// <summary>
        /// Draws the control.
        /// </summary>
        protected override void Draw()
        {
            UpdateTimer();
            Update();

            // Clear to the default control background color.
            //Color backColor = new Color(BackColor.R, BackColor.G, BackColor.B);
            Color backColor = Color.White;

            GraphicsDevice.Clear(backColor);

            if (DrawingBatch != null && Texture != null && SpriteFont != null)
            {
                drawingContext.Begin();
                drawingContext.DrawLine(10, 20, 100, 20, Color.Red);
                drawingContext.DrawRectangle(120, 10, 100, 20, Color.Blue);
                drawingContext.DrawTriangle(240, 10, 240, 60, 200, 60, Color.Black);
                drawingContext.DrawEllipse(310, 10, 50, 50, Color.Green);
                drawingContext.DrawTexture(texture, new Vector2(10, 300), Color.White);
                drawingContext.DrawPolyline(new Vector2[] { new Vector2(410, 10), new Vector2(440, 10), new Vector2(420, 20), new Vector2(440, 40), new Vector2(410, 60) }, Color.Aqua);
                drawingContext.DrawFilledRectangle(120, 110, 50, 50, Color.Blue);
                drawingContext.DrawFilledTriangle(240, 110, 240, 160, 200, 160, Color.Brown);
                drawingContext.DrawFilledEllipse(310, 110, 80, 40, Color.Green);
                drawingContext.DrawText(SpriteFont, "Hello World!", new Vector2(120, 300), Color.Black);
                drawingContext.End();
            }
        }
예제 #2
0
 /// <summary>
 ///  Draw group selection rectangle
 /// </summary>
 /// <param name="g"></param>
 public void DrawNetSelection(XnaDrawingContext g)
 {
     if (!DrawNetRectangle)
     {
         return;
     }
     //var r = new System.Drawing.Rectangle(Convert.ToInt32(NetRectangle.X), Convert.ToInt32(NetRectangle.Y),
     //    Convert.ToInt32(NetRectangle.Width), Convert.ToInt32(NetRectangle.Height));
     g.DrawRectangle(NetRectangle, Color.Black);
     //ControlPaint.DrawFocusRectangle(g, r, System.Drawing.Color.Black, System.Drawing.Color.Transparent);
 }
예제 #3
0
        public void Draw(XnaDrawingContext g)
        {
            //var brush = new SolidBrush(System.Drawing.Color.FromArgb(255, 255, 255));
            var       brushColor      = Color.FromNonPremultiplied(255, 255, 255, 255);
            Rectangle clientRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width, ClientRectangle.Height);

            g.DrawFilledRectangle(clientRectangle, brushColor);
            // draw rect svg size
            var penColor = Color.FromNonPremultiplied(0, 0, 255, 255);

            //var pen = new Pen(System.Drawing.Color.FromArgb(0, 0, 255), 1);
            g.DrawRectangle(0, 0, SizePicture.X, SizePicture.Y, penColor);
            if (_graphicsList != null)
            {
                _graphicsList.Draw(g);
            }
            //brush.Dispose();
        }
예제 #4
0
        public void LoadContent()
        {
            PresentationParameters pp = GraphicsDevice.PresentationParameters;
            int bufferWidth           = pp.BackBufferWidth;
            int bufferHeight          = pp.BackBufferHeight;

            drawingTexture = new DrawingTexture(GraphicsDevice, bufferWidth, bufferHeight);
            drawingTexture.Clear(Microsoft.Xna.Framework.Color.White);

            XnaDrawingContext drawingContext = drawingTexture.DrawingContext;

            drawingContext.Begin();
            drawingContext.DrawLine(10, 20, 100, 20, Microsoft.Xna.Framework.Color.Red);
            drawingContext.DrawRectangle(120, 10, 100, 20, Microsoft.Xna.Framework.Color.Blue);
            drawingContext.DrawTriangle(240, 10, 240, 60, 200, 60, Microsoft.Xna.Framework.Color.Black);
            drawingContext.DrawEllipse(310, 10, 50, 50, Microsoft.Xna.Framework.Color.Green);
            drawingContext.DrawTexture(texture, new Vector2(10, 300), Microsoft.Xna.Framework.Color.White);
            drawingContext.DrawPolyline(new Vector2[] { new Vector2(410, 10), new Vector2(440, 10), new Vector2(420, 20), new Vector2(440, 40), new Vector2(410, 60) }, Microsoft.Xna.Framework.Color.Aqua);
            drawingContext.DrawFilledRectangle(120, 110, 50, 50, Microsoft.Xna.Framework.Color.Blue);
            drawingContext.DrawFilledTriangle(240, 110, 240, 160, 200, 160, Microsoft.Xna.Framework.Color.Brown);
            drawingContext.DrawFilledEllipse(310, 110, 80, 40, Microsoft.Xna.Framework.Color.Green);
            drawingContext.DrawText(SpriteFont, "Hello World!", new Vector2(120, 300), Microsoft.Xna.Framework.Color.Black);
            drawingContext.End();
        }