示例#1
0
 protected PObject PObjectStatusSelect(DeviceResources deviceResources, GraphicsSignature graphicsSignature, ref PSODesc desc, PObject pObject, PObject loading, PObject unload, PObject error)
 {
     if (pObject == null)
     {
         return(unload);
     }
     if (pObject.Status == GraphicsObjectStatus.unload)
     {
         return(unload);
     }
     else if (pObject.Status == GraphicsObjectStatus.loaded)
     {
         if (pObject.GetVariantIndex(deviceResources, graphicsSignature, desc) != -1)
         {
             return(pObject);
         }
         else
         {
             return(error);
         }
     }
     else if (pObject.Status == GraphicsObjectStatus.loading)
     {
         return(loading);
     }
     else
     {
         return(error);
     }
 }
        public void Draw(int[] numbers, RectangleF rectangle, GraphicsSignature signature)
        {
            float indentX = (rectangle.Width - (rectangle.X + signature.Font.Size)) / (numbers.Count() * signature.Font.Size);
            float indentY = (rectangle.Height / 2 - signature.Font.Size) / (numbers.Count() * signature.Font.Size);

            var listPoints = new List <PointF>();

            float pointSize = signature.Font.Size / 2;

            for (int i = 1; i < numbers.Count() + 1; i++)
            {
                float x = i * signature.Font.Size * indentX;
                float y = -numbers[i - 1] * signature.Font.Size /
                          ((float)numbers.Max(itr => Math.Abs(itr)) / numbers.Count()) * indentY;

                listPoints.Add(new PointF(x, y));

                graphics.DrawEllipse(signature.EllipsePen, x - pointSize / 2, y - pointSize / 2,
                                     pointSize, pointSize);

                graphics.DrawString(numbers[i - 1].ToString(), signature.Font,
                                    signature.Brush, x + pointSize, y);
            }

            graphics.DrawLines(signature.Pen, listPoints.ToArray());
        }
        public void Draw(int[] numbers, RectangleF rectangle, GraphicsSignature signature, Graphics graphics)
        {
            var tempGraphics = this.graphics;

            this.graphics = graphics;

            Draw(numbers, rectangle, signature);

            this.graphics = tempGraphics;
        }
示例#4
0
        private void Button1_Click(object sender, EventArgs e)
        {
            pictureBox1.Refresh();

            var g = pictureBox1.CreateGraphics();

            g.TranslateTransform(offset.X, offset.Y);

            var p = new Pen(Color.Green, 3);

            p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;

            graphicsSignature = new GraphicsSignature
            {
                Pen   = p,
                Brush = Brushes.Blue,
                Font  = new Font("Arial", 10),
            };

            drawingGraphics = new DrawingGraphics(g);
            drawingGraphics.Draw(numbers, new RectangleF(offset.X, -offset.Y,
                                                         pictureBox1.Width, pictureBox1.Height), graphicsSignature);
        }
示例#5
0
        protected void SetPipelineStateVariant(DeviceResources deviceResources, GraphicsContext graphicsContext, GraphicsSignature graphicsSignature, ref PSODesc desc, PObject pObject)
        {
            int variant = pObject.GetVariantIndex(deviceResources, graphicsSignature, desc);

            graphicsContext.SetPObject1(pObject, variant);
        }