FillPolygon() публичный метод

public FillPolygon ( Brush brush, Point points, FillMode fillMode = FillMode.Alternate ) : void
brush Brush
points Point
fillMode FillMode
Результат void
Пример #1
1
		static protected void DrawBrick (Graphics graphics, Brush b1, Brush b2, Brush b3)
		{
			if (graphics == null) return;
			graphics.FillPolygon (b1, brickPoints1);
			graphics.FillPolygon (b2, brickPoints2);
			graphics.FillPolygon (b3, brickPoints3);
		}
Пример #2
1
		internal override void Draw(Graphics g)
		{
			IsInvalidated = false;

			Rectangle r = BaseElement.GetUnsignedRectangle(new Rectangle(location, size));

			Point[] points = new Point[5];
			points[0] = new Point(r.X + 0, r.Y + 0);
			points[1] = new Point(r.X + 0, r.Y + r.Height);
			points[2] = new Point(r.X + r.Width, r.Y + r.Height);

			//Fold
			points[3] = new Point(r.X + r.Width, r.Y + foldSize.Height);
			points[4] = new Point(r.X + r.Width - foldSize.Width, r.Y + 0);

			//foreach(Point p in points) p.Offset(location.X, location.Y);

			g.FillPolygon(GetBrush(r), points, FillMode.Alternate);
			g.DrawPolygon(new Pen(borderColor, borderWidth), points);

			g.DrawLine(new Pen(borderColor, borderWidth),
			           new Point(r.X + r.Width - foldSize.Width, r.Y + foldSize.Height),
			           new Point(r.X + r.Width, r.Y + foldSize.Height));

			g.DrawLine(new Pen(borderColor, borderWidth),
			           new Point(r.X + r.Width - foldSize.Width, r.Y + 0),
			           new Point(r.X + r.Width - foldSize.Width, r.Y + 0 + foldSize.Height));
		}
Пример #3
1
        public static void RepertoryImage(Graphics drawDestination)
        {
            StringFormat itemStringFormat = new StringFormat();
            RectangleF itemBox = new RectangleF(10, 30, 42, 10);
            RectangleF itemBox2 = new RectangleF(60, 48, 10, 10);
            itemStringFormat.Alignment = StringAlignment.Center;
            itemStringFormat.LineAlignment = StringAlignment.Far;
            drawDestination.DrawLine(Pens.LightGray,10,10,10,70);
            if (mMscStyle == MscStyle.SDL){
                PointF[] capPolygon = new PointF[3];
                capPolygon[0] = new PointF(61, 40);
                capPolygon[1] = new PointF(53, 44);
                capPolygon[2] = new PointF(53, 36);
                drawDestination.FillPolygon(Brushes.Black,capPolygon);
                drawDestination.DrawString("Lost",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                drawDestination.DrawString("g",new Font("Arial",8),Brushes.Black,itemBox2,itemStringFormat);
                drawDestination.DrawLine(Pens.Black,10, 40, 60,40);
                drawDestination.FillEllipse(Brushes.Black, new RectangleF(60,35, 10,10));
            }
            else if(mMscStyle == MscStyle.UML2){

                drawDestination.DrawString("Lost",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                drawDestination.DrawString("g",new Font("Arial",8),Brushes.Black,itemBox2,itemStringFormat);
                drawDestination.DrawLine(Pens.Black,10, 40, 60,40);
                drawDestination.DrawLine(Pens.Black,60, 40, 54,43);
                drawDestination.DrawLine(Pens.Black,60, 40, 54,37);
                drawDestination.FillEllipse(Brushes.Black, new RectangleF(60,35, 10,10));

            }
            itemStringFormat.Dispose();
        }
Пример #4
0
        Bitmap drawBattleDice(Graphics gDice, Bitmap diceBitmap, Pen myPen, Brush myBrush, int level, int randomNumber)
        {
            gDice.Clear(Color.Transparent);
            PointF[] Verticies;
                Verticies = new PointF[3];
                Verticies[0] = new PointF(0, pbDice.Height - 1);
                Verticies[1] = new PointF(pbDice.Width - 1, pbDice.Height - 1);
                Verticies[2] = new PointF(pbDice.Width / 2.0f, (float)(pbDice.Height - 1 - pbDice.Height / 2 * Math.Sqrt(3)));

                if (level == 1)
                    gDice.FillPolygon(new SolidBrush(Color.Green), Verticies);
                else if(level==2)
                    gDice.FillPolygon(new SolidBrush(Color.Red), Verticies);
                else if (level == 3)
                    gDice.FillPolygon(new SolidBrush(Color.Blue), Verticies);
                else if (level == 4)
                    gDice.FillPolygon(new SolidBrush(Color.Purple), Verticies);
                myPen.Color = Color.Black;
                gDice.DrawPolygon(myPen, Verticies);
            Font font = new Font("Times New Roman", 16, FontStyle.Bold);
            StringFormat format = new StringFormat();
            Brush whiteBrush = new SolidBrush(Color.White);
            format.Alignment = StringAlignment.Center;
            RectangleF rect = new RectangleF(pbDice.Width / 2 - 20 , pbDice.Height / 2 - 4 , 40 , 25);
            if (randomNumber == 0)
            {
                rect.Y = pbDice.Height / 2 + 6;
                gDice.DrawString("Roll", new Font("Times New Roman", 14, FontStyle.Italic), whiteBrush, rect, format);
            }
            else
            {
                gDice.DrawString(randomNumber.ToString(), font, whiteBrush, rect, format);
            }
            return diceBitmap;
        }
Пример #5
0
        /// <summary>
        /// Function to draw the dropdown button.
        /// </summary>
        /// <param name="pe"></param>
        protected override void OnPaint(PaintEventArgs pe)
        {
            //Draw button base.
            base.OnPaint(pe);

            //Check if we have a connected panel and sets its visability.
            if (this.connectedPanel != null && connectedPanel.Visible != this.selected)
            {
                connectedPanel.Visible = this.selected;
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }

            //Create brushes.
            System.Drawing.SolidBrush triangleBrush = new System.Drawing.SolidBrush(this.triangleColor);

            //Create graphics object.
            System.Drawing.Graphics formGraphics = this.CreateGraphics();

            Point triangleTop;
            Point triangleLeft;
            Point triangleRight;

            //Flip rectangle if it is selected.
            if (this.Selected)
            {
                triangleTop   = new Point(this.TriangleSize / 2, 0);
                triangleLeft  = new Point(0, TriangleSize);
                triangleRight = new Point(TriangleSize, TriangleSize);
            }
            else
            {
                triangleTop   = new Point(TriangleSize / 2, TriangleSize);
                triangleLeft  = new Point(0, 0);
                triangleRight = new Point(TriangleSize, 0);
            }

            //Calculate height value for vertical centering.
            int rectangleYPosition = (this.Size.Height - this.TriangleSize) / 2;

            //Add padding for left and right triangle.
            Point[] baseTrianglePoints        = { triangleTop, triangleLeft, triangleRight };
            int     tempPaddingFirstTriangle  = (int)((float)this.Size.Width / 750 * this.PaddingFirstTriangle);
            int     tempPaddingSecondTriangle = (int)((float)this.Size.Width / 750 * this.PaddingSecondTriangle);

            Point[] leftTrianglePoints  = Array.ConvertAll(baseTrianglePoints, element => new Point(element.X + tempPaddingFirstTriangle, element.Y + rectangleYPosition));
            Point[] rightTrianglePoints = Array.ConvertAll(baseTrianglePoints, element => new Point(element.X + tempPaddingSecondTriangle, element.Y + rectangleYPosition));

            if (this.paddingFirstTriangle != -1)
            {
                formGraphics.FillPolygon(triangleBrush, leftTrianglePoints);
            }
            if (this.paddingSecondTriangle != -1)
            {
                formGraphics.FillPolygon(triangleBrush, rightTrianglePoints);
            }

            //Clean.
            formGraphics.Dispose();
        }
Пример #6
0
        public void DrawIsometricView(Graphics g)
        {
            Point3[] ptsBottom = CircleCoordinates (-h / 2);
            var ptaBottom = new PointF[ptsBottom.Length];
            Point3[] ptsTop = CircleCoordinates (h / 2);
            var ptaTop = new PointF[ptsTop.Length];
            Matrix3 m = Matrix3.Axonometric (35.26f, -45);
            for (int i = 0; i < ptsBottom.Length; i++) {
                ptsBottom [i].Transform (m);
                ptaBottom [i] = Point2D (new CGPoint (ptsBottom [i].X, ptsBottom [i].Y));
                ptsTop [i].Transform (m);
                ptaTop [i] = Point2D (new CGPoint (ptsTop [i].X, ptsTop [i].Y));
            }

            var ptf = new PointF[4];
            for (int i = 1; i < ptsTop.Length; i++) {
                ptf [0] = ptaBottom [i - 1];
                ptf [1] = ptaTop [i - 1];
                ptf [2] = ptaTop [i];
                ptf [3] = ptaBottom [i];
                if (i < 5 || i > ptsTop.Length - 12) {
                    g.FillPolygon (Brushes.White, ptf);
                    g.DrawPolygon (Pens.Black, ptf);
                }
            }

            g.FillPolygon (Brushes.White, ptaTop);
            g.DrawPolygon (Pens.Black, ptaTop);
        }
        public override void Draw(Graphics g, TimeRuler ruler)
        {
            if (ruler.Orientation == enumOrientation.orHorizontal)
            {
                int iSecondPos = ruler.ScaleValueToPixel((double) _StartMillisecond);
                int x = iSecondPos - 1;
                int y1 = ruler.HeaderOffset/2, y2 = ruler.Height;
                g.DrawLine(new Pen(new SolidBrush(this.Color), 3), x, y1, x, y2);

                Point left = new Point(iSecondPos - y1, 1);
                Point right = new Point(iSecondPos + y1, 1);
                Point bottom = new Point(iSecondPos, ruler.HeaderOffset/2);
                Point[] trianglePoints = {left, right, bottom};
                g.FillPolygon(new SolidBrush(this.Color), trianglePoints, System.Drawing.Drawing2D.FillMode.Winding);

                g.DrawPolygon(new Pen(new SolidBrush(ruler.ForeColor)), trianglePoints);
            }
            else
            {
                int iSecondPos = ruler.ScaleValueToPixel((double) _StartMillisecond);
                int y = iSecondPos - 1;
                int x1 = ruler.HeaderOffset/2, x2 = ruler.Height;
                g.DrawLine(new Pen(new SolidBrush(this.Color), 3), x1, y, x2, y);

                Point left = new Point(1, iSecondPos - x1);
                Point right = new Point(1, iSecondPos + x1);
                Point bottom = new Point(ruler.HeaderOffset/2, iSecondPos);
                Point[] trianglePoints = {left, right, bottom};
                g.FillPolygon(new SolidBrush(this.Color), trianglePoints, System.Drawing.Drawing2D.FillMode.Winding);

                g.DrawPolygon(new Pen(new SolidBrush(ruler.ForeColor)), trianglePoints);
            }
        }
Пример #8
0
        public void Draw(System.Drawing.Graphics g, System.Drawing.RectangleF innerArea)
        {
            innerArea.Inflate(_shadowLength / 2, _shadowLength / 2); // Padding
            RectangleF outerArea = innerArea;

            outerArea.Inflate(_shadowLength, _shadowLength);

            _brush.Rectangle = outerArea;
            g.FillRectangle(_brush, outerArea);

            SolidBrush twhite = new SolidBrush(Color.FromArgb(128, 255, 255, 255));

            g.FillPolygon(twhite, new PointF[] {
                new PointF(outerArea.Left, outerArea.Top),                                      // upper left point
                new PointF(outerArea.Right, outerArea.Top),                                     // go to the right
                new PointF(innerArea.Right, innerArea.Top),                                     // go 45 deg left down in the upper right corner
                new PointF(innerArea.Left, innerArea.Top),                                      // upper left corner of the inner rectangle
                new PointF(innerArea.Left, innerArea.Bottom),                                   // lower left corner of the inner rectangle
                new PointF(outerArea.Left, outerArea.Bottom)                                    // lower left corner
            });

            SolidBrush tblack = new SolidBrush(Color.FromArgb(128, 0, 0, 0));

            g.FillPolygon(tblack, new PointF[] {
                new PointF(outerArea.Right, outerArea.Bottom),
                new PointF(outerArea.Right, outerArea.Top),
                new PointF(innerArea.Right, innerArea.Top),
                new PointF(innerArea.Right, innerArea.Bottom),                                    // upper left corner of the inner rectangle
                new PointF(innerArea.Left, innerArea.Bottom),                                     // lower left corner of the inner rectangle
                new PointF(outerArea.Left, outerArea.Bottom)                                      // lower left corner
            });
        }
Пример #9
0
        public void DrawBox(Box box)
        {
            System.Drawing.Graphics g = Graphics;

            // get points
            Point[] pt = TransformPoint(box.TopFace.Points);

            // draw solid face
            Brush brushSolid = new SolidBrush(box.TopFace.ColorFill);

            g.FillPolygon(brushSolid, pt);
            // draw box tape
            if (box.TapeWidth.Activated)
            {
                // instantiate brush
                Brush brushTape = new SolidBrush(box.TapeColor);
                // fill polygon
                Point[] pts = TransformPoint(box.TapePoints);
                g.FillPolygon(brushTape, pts);
            }

            Brush brushPath = new SolidBrush(box.TopFace.ColorPath);
            Pen   penPath   = new Pen(brushPath);

            g.DrawPolygon(penPath, pt);
        }
Пример #10
0
        public override void Draw(Graphics2D graphics)
        {
            System.Drawing.Graphics g = graphics.Graphics;
            Pen penPath = new Pen(new SolidBrush(TopFace.ColorPath));

            // get points
            Point[] ptsFace = graphics.TransformPoint(TopFace.Points);

            // draw solid face
            Brush brushSolid = new SolidBrush(TopFace.ColorFill);

            g.FillPolygon(brushSolid, ptsFace);
            g.DrawPolygon(penPath, ptsFace);
            // draw box tape
            if (TapeWidth.Activated)
            {
                // instantiate brush
                Brush brushTape = new SolidBrush(TapeColor);
                // fill polygon
                Point[] ptsTape = graphics.TransformPoint(TapePoints);
                g.FillPolygon(brushTape, ptsTape);
                g.DrawPolygon(penPath, ptsTape);
            }
            // orientation mark
            if (ShowOrientationMark)
            {
                Pen      penPathOrientationMark = new Pen(new SolidBrush(OrientationMarkColor), 5.0F);
                Vector3D pt0           = TopFace.Points[0];
                Vector3D pt1           = TopFace.Points[1];
                double   offset        = 0.1 * (pt1 - pt0).GetLength();
                Point[]  ptsOrientMark = graphics.TransformPoint(new Vector3D[] { pt0 + new Vector3D(offset, offset, 0.0), pt1 + new Vector3D(-offset, offset, 0.0) });
                g.DrawLine(penPathOrientationMark, ptsOrientMark[0], ptsOrientMark[1]);
            }
        }
Пример #11
0
		public override void Draw(Graphics graphics)
		{
			if (graphics == null) return;
			graphics.FillPolygon (Brushes.DarkGoldenrod, lightningPoints2);
			graphics.FillPolygon (Brushes.DarkGoldenrod, lightningPoints3);
			graphics.FillPolygon (Brushes.DarkGoldenrod, lightningPoints4);
			graphics.FillPolygon (Brushes.Gold, lightningPoints1);
		}
Пример #12
0
 public static void RepertoryImage(Graphics drawDestination, MessageStyle style, MscStyle style2)
 {
     StringFormat itemStringFormat = new StringFormat();
     RectangleF itemBox = new RectangleF(10, 28, 60, 15);
     Pen pen = new Pen(Color.Black);
     float[] pattern = {3f,3f};
     itemStringFormat.Alignment = StringAlignment.Center;
     drawDestination.DrawString("Message",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     drawDestination.DrawLine(Pens.DarkGray,5,10,5,70);
     drawDestination.DrawLine(Pens.DarkGray,75,10,75,70);
     if (style2 == MscStyle.SDL){
         if((style == MessageStyle.Normal)||(style == MessageStyle.Synchron)){
             drawDestination.DrawLine(Pens.Black,5,40,75,40);
             PointF[] messagePolygon = new PointF[3];
             messagePolygon[0] = new PointF(5, 40);
             messagePolygon[1] = new PointF(5+8, 40-4);
             messagePolygon[2] = new PointF(5+8, 40+4);
             drawDestination.FillPolygon(Brushes.Black,messagePolygon);
         }
         else if (style == MessageStyle.Dashed){
             pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
             pen.DashPattern = pattern;
             drawDestination.DrawLine(pen,5,40,75,40);
             PointF[] messagePolygon = new PointF[3];
             messagePolygon[0] = new PointF(5, 40);
             messagePolygon[1] = new PointF(5+8, 40-4);
             messagePolygon[2] = new PointF(5+8, 40+4);
             drawDestination.FillPolygon(Brushes.Black,messagePolygon);
             pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
         }
     }
     else if(style2 == MscStyle.UML2){
         if( style == MessageStyle.Normal){
             drawDestination.DrawLine(Pens.Black,5,40,75,40);
             drawDestination.DrawLine(Pens.Black,5,40,5+8, 40-4);
             drawDestination.DrawLine(Pens.Black,5,40,5+8, 40+4);
         }
         else if( style == MessageStyle.Dashed){
             pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
             pen.DashPattern = pattern;
             drawDestination.DrawLine(pen,5,40,75,40);
             pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
             drawDestination.DrawLine(Pens.Black,5,40,5+8, 40-4);
             drawDestination.DrawLine(Pens.Black,5,40,5+8, 40+4);
         }
         else if( style == MessageStyle.Synchron){
             drawDestination.DrawLine(Pens.Black,5,40,75,40);
             PointF[] messagePolygon = new PointF[3];
             messagePolygon[0] = new PointF(5, 40);
             messagePolygon[1] = new PointF(5+8, 40-4);
             messagePolygon[2] = new PointF(5+8, 40+4);
             drawDestination.FillPolygon(Brushes.Black,messagePolygon);
         }
     }
     pen.Dispose();
     itemStringFormat.Dispose();
 }
Пример #13
0
        public static void Draw(Graphics g)
        {
            Point[] p = { new Point(240, 110), new Point(440, 110), new Point(510, 150), new Point(300, 150) };
            TextureBrush tBrush = new TextureBrush(Image.FromFile(@"Images\0073.jpg"));
            g.FillPolygon(tBrush, p);

            Point[] p1 = { new Point(240, 110), new Point(300, 150), new Point(300, 360), new Point(240, 310) };
            HatchBrush hBrush = new HatchBrush(HatchStyle.DashedDownwardDiagonal, Color.Violet, Color.White);
            g.FillPolygon(hBrush, p1);
        }
Пример #14
0
        /// <summary>
        /// Draws the shape.
        /// </summary>
        /// <param name="G">The g.</param>
        /// <param name="FillShape">The fill shape.</param>
        /// <param name="DrawShape">The draw shape.</param>
        /// <exception cref="ArgumentOutOfRangeException">
        /// FillModes - null
        /// or
        /// FillModes - null
        /// or
        /// ShapeTypes - null
        /// </exception>
        public void DrawShape(System.Drawing.Graphics G, Brush FillShape, Pen DrawShape)
        {
            foreach (List <Point> points in Points)
            {
                switch (ShapeType)
                {
                case ShapeTypes.Polygon:
                    switch (FillMode)
                    {
                    case FillModes.Fill:
                        G.FillPolygon(FillShape, points.ToArray());
                        break;

                    case FillModes.Border:
                        G.DrawPolygon(DrawShape, points.ToArray());
                        break;

                    case FillModes.Both:
                        G.FillPolygon(FillShape, points.ToArray());
                        G.DrawPolygon(DrawShape, points.ToArray());
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(FillModes), FillMode, null);
                    }

                    break;

                case ShapeTypes.Spline:
                    switch (FillMode)
                    {
                    case FillModes.Fill:
                        G.FillClosedCurve(FillShape, points.ToArray());
                        break;

                    case FillModes.Border:
                        G.DrawClosedCurve(DrawShape, points.ToArray());
                        break;

                    case FillModes.Both:
                        G.FillClosedCurve(FillShape, points.ToArray());
                        G.DrawClosedCurve(DrawShape, points.ToArray());
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(FillModes), FillMode, null);
                    }

                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(ShapeTypes), ShapeType, null);
                }
            }
        }
Пример #15
0
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            g = e.Graphics;

            Point[] Triangle =
            {
                new Point (100, 5),
                new Point(33, 108),
                new Point(167, 108),
            };
            g.DrawPolygon(p, Triangle);
            g.FillPolygon(b, Triangle);

            g.DrawRectangle(p, 33, 108, 134, 100);
            g.FillRectangle(b, 33, 108, 134, 100);
            
            g.FillEllipse(new SolidBrush(Color.Red), 85, 68, 30, 30);

            Point[] Door =
            {
                new Point(124, 167),
                new Point(124, 208),
                new Point(167, 167),
                new Point (167, 208),
            };
            g.DrawRectangle(p, 124, 167, 42, 41);
            g.FillRectangle(new SolidBrush (Color.Gray), 124, 167, 42, 41);

            g.DrawLine(p, 145, 190, 150, 190);

            g.DrawRectangle(p, 33, 130, 35, 35);
            g.FillRectangle(new SolidBrush(Color.White), 33, 130, 35, 35);
            g.DrawLine(p, 33, 148, 68, 148);
            g.DrawLine(p, 51, 130, 51, 165);

            g.DrawLine(p2, 334, 210, 334, 165);

            Point[] PolyPoints =
            {
                new Point (334, 165),
                new Point (334, 125),
                new Point (354, 136),
                new Point (354, 156),
                new Point (334, 165),
                new Point (314, 156),
                new Point (314, 136),
                new Point (334, 125),
            };
            g.DrawPolygon(p, PolyPoints);
            g.FillPolygon(new SolidBrush(Color.Yellow), PolyPoints);
            g.DrawPolygon(new Pen(Color.Red, 3), PolyPoints);

            g.DrawLine(new Pen (Color.Red, 3), 314, 136, 354, 156);
            g.DrawLine(new Pen(Color.Red, 3), 314, 156, 354, 136);
        }
Пример #16
0
        /// <summary>
        /// Draw the filled region
        /// </summary>
        /// <param name="g">The GDI+ surface on which to draw.</param>
        /// <param name="xAxis">The X-Axis to draw against.</param>
        /// <param name="yAxis">The Y-Axis to draw against.</param>
        public void Draw(System.Drawing.Graphics g, PhysicalAxis xAxis, PhysicalAxis yAxis)
        {
            ITransform2D t = Transform2D.GetTransformer(xAxis, yAxis);

            Brush b = brush_;

            if (b == null)
            {
                b = areaBrush_.Get(new Rectangle(xAxis.PhysicalMin.X, yAxis.PhysicalMax.Y, xAxis.PhysicalLength, yAxis.PhysicalLength));
            }

            if (hl1_ != null && hl2_ != null)
            {
                PointF[] points = new PointF[4];
                points[0] = t.Transform(xAxis.Axis.WorldMin, hl1_.OrdinateValue);
                points[1] = t.Transform(xAxis.Axis.WorldMax, hl1_.OrdinateValue);
                points[2] = t.Transform(xAxis.Axis.WorldMax, hl2_.OrdinateValue);
                points[3] = t.Transform(xAxis.Axis.WorldMin, hl2_.OrdinateValue);

                g.FillPolygon(b, points);
            }
            else if (vl1_ != null && vl2_ != null)
            {
                PointF[] points = new PointF[4];
                points[0] = t.Transform(vl1_.AbscissaValue, yAxis.Axis.WorldMin);
                points[1] = t.Transform(vl1_.AbscissaValue, yAxis.Axis.WorldMax);
                points[2] = t.Transform(vl2_.AbscissaValue, yAxis.Axis.WorldMax);
                points[3] = t.Transform(vl2_.AbscissaValue, yAxis.Axis.WorldMin);

                g.FillPolygon(b, points);
            }
            else if (lp1_ != null && lp2_ != null)
            {
                SequenceAdapter a1 = new SequenceAdapter(lp1_.DataSource, lp1_.DataMember, lp1_.OrdinateData, lp1_.AbscissaData);
                SequenceAdapter a2 = new SequenceAdapter(lp2_.DataSource, lp2_.DataMember, lp2_.OrdinateData, lp2_.AbscissaData);


                int      count  = a1.Count + a2.Count;
                PointF[] points = new PointF[count];
                for (int i = 0; i < a1.Count; ++i)
                {
                    points[i] = t.Transform(a1[i]);
                }
                for (int i = 0; i < a2.Count; ++i)
                {
                    points[i + a1.Count] = t.Transform(a2[a2.Count - i - 1]);
                }

                g.FillPolygon(b, points);
            }
            else
            {
                throw new NPlotException("One of bounds was set to null");
            }
        }
Пример #17
0
 public override System.Drawing.Bitmap GetNext()
 {
     System.Drawing.Bitmap result;
     lock (this.newBitmap)
     {
         lock (this.oldBitmap)
         {
             if (this.nowState == MarqueeDisplayState.First)
             {
                 this.nowPosition = (int)this.nowPositionF;
                 int arg_52_0 = (this.newBitmap.Width - this.nowPosition) / 2;
                 System.Drawing.Bitmap   bitmap   = new System.Drawing.Bitmap(this.oldBitmap);
                 System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap);
                 this.GetLeft(this.nowPosition);
                 System.Drawing.SolidBrush solidBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Purple);
                 System.Drawing.Bitmap     bitmap2    = new System.Drawing.Bitmap(this.newBitmap);
                 System.Drawing.Graphics   graphics2  = System.Drawing.Graphics.FromImage(bitmap2);
                 graphics2.FillPolygon(solidBrush, this.pointLeft);
                 graphics2.FillPolygon(solidBrush, this.pointRight);
                 bitmap2.MakeTransparent(System.Drawing.Color.Purple);
                 graphics.DrawImage(bitmap2, new System.Drawing.Point(0, 0));
                 graphics2.Dispose();
                 solidBrush.Dispose();
                 bitmap2.Dispose();
                 graphics.Dispose();
                 this.nowPositionF -= this.step;
                 if (this.nowPositionF <= 0f)
                 {
                     this.nowState = MarqueeDisplayState.Stay;
                 }
                 result = bitmap;
             }
             else if (this.nowState == MarqueeDisplayState.Stay)
             {
                 this.StayNum += 42;
                 if (this.StayNum > this.effect.Stay)
                 {
                     if (this.effect.ExitMode == 0)
                     {
                         result = null;
                         return(result);
                     }
                     this.nowState = MarqueeDisplayState.Exit;
                 }
                 result = new System.Drawing.Bitmap(this.newBitmap);
             }
             else
             {
                 result = this.Exit.GetNext();
             }
         }
     }
     return(result);
 }
        /// <summary>
        /// Draw Function.</summary>
        /// <param name="g">Graphics for Drawing</param>
        public void Draw(Graphics g)
        {
            g.FillRectangle(Brushes.Yellow, centerIndicator);
            g.DrawRectangle(Pens.Black, centerIndicator);

            g.FillPolygon(Brushes.Yellow, leftIndicator);
            g.DrawPolygon(Pens.Black, leftIndicator);

            g.FillPolygon(Brushes.Yellow, rightIndicator);
            g.DrawPolygon(Pens.Black, rightIndicator);
        }
Пример #19
0
        public static void DrawBone(Bone b, Graphics graph, PointF rootPos, bool selected = false)
        {
            if (b.IsRoot)
            {
                if (selected)
                {
                    graph.DrawEllipse(Pens.Orange, rootPos.X - 30, rootPos.Y - 30, 60, 60);
                }
                else
                {
                    graph.DrawEllipse(Pens.Black, rootPos.X - 30, rootPos.Y - 30, 60, 60);
                }
            }
            else
            {
                PointV p0 = new PointV(b.StartPoint);
                PointV p3 = new PointV(b.EndPoint);
                PointV p1 = p3 - p0;
                PointV p2 = p1.Rotate(-0.2745);
                p1 = p1.Rotate(0.2745);
                p2.Length = p2.Length * 0.2;
                p1.Length = p1.Length * 0.2;
                p2 = p2 + p0;
                p1 = p1 + p0;
                Pen pen0 = new Pen(Color.Black);
                Brush brush0 = new SolidBrush(Color.FromArgb(180, Color.DarkGray));
                Pen pen1 = new Pen(Color.Black);
                pen1.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
                PointF[] pts = new PointF[] { p0.Add(rootPos).Point, p1.Add(rootPos).Point,
                        p3.Add(rootPos).Point, p2.Add(rootPos).Point };
                if (selected)
                {
                    brush0 = new SolidBrush(Color.FromArgb(180, Color.Orange));
                    pen1.Color = Color.Orange;
                    pen0.Color = Color.Orange;
                    graph.DrawPolygon(pen0, pts);
                    graph.FillPolygon(brush0, pts);
                    graph.DrawLine(pen1, PointV.Add(rootPos, b.StartPoint), PointV.Add(rootPos, b.Parent.EndPoint));

                }
                else
                {
                    graph.DrawPolygon(pen0, pts);
                    graph.FillPolygon(brush0, pts);
                    graph.DrawLine(pen1, PointV.Add(rootPos, b.StartPoint), PointV.Add(rootPos, b.Parent.EndPoint));
                }

            }
        }
        /// <summary>
        /// Renders a polygon to the map.
        /// </summary>
        /// <param name="g">Graphics reference</param>
        /// <param name="pol">Polygon to render</param>
        /// <param name="brush">Brush used for filling (null or transparent for no filling)</param>
        /// <param name="pen">Outline pen style (null if no outline)</param>
        /// <param name="clip">Specifies whether polygon clipping should be applied</param>
        /// <param name="map">Map reference</param>
        public static void DrawPolygon(System.Drawing.Graphics g, IPolygon pol, System.Drawing.Brush brush, System.Drawing.Pen pen, bool clip, IMap map)
        {
            try
            {
                if (pol.Shell == null)
                {
                    return;
                }

                if (pol.Shell.Coordinates.Length > 2)
                {
                    var points = Transform.TransformToImage(pol.Shell, map, SimplifyGeometryDuringRendering);

                    var solidBrush = brush as SolidBrush;
                    if (solidBrush != null && solidBrush.Color.A != 0)
                    {
                        g.FillPolygon(brush, points, FillMode.Alternate);
                    }

                    if (pen != null)
                    {
                        g.DrawPolygon(pen, points);
                    }

                    for (int i = 0; i < pol.Holes.Length; i++)
                    {
                        points = Transform.TransformToImage(pol.Holes[i], map, SimplifyGeometryDuringRendering);
                        if (solidBrush != null && solidBrush.Color.A != 0)
                        {
                            g.FillPolygon(brush, points);
                        }

                        if (pen != null)
                        {
                            g.DrawPolygon(pen, points);
                        }
                    }
                }
            }
            catch (InvalidOperationException e)
            {
                log.WarnFormat("Error during rendering", e);
            }
            catch (OverflowException e)
            {
                log.WarnFormat("Error during rendering", e);
            }
        }
Пример #21
0
        public override void Draw(Graphics3D graphics)
        {
            System.Drawing.Graphics g = graphics.Graphics;
            Vector3D viewDir          = graphics.ViewDirection;

            // build pen path
            Brush brushPath = new SolidBrush(ColorPath);
            Pen   penPath   = new Pen(brushPath, 1.7f);

            // bottom, top
            Point[] ptsBottom = graphics.TransformPoint(GetBottomPoints());
            Point[] ptsTop    = graphics.TransformPoint(GetTopPoints());

            // outer wall
            Face[] facesWalls = GetFaceWalls();
            foreach (Face face in facesWalls)
            {
                try
                {
                    var normal = face.Normal;
                    // visible ?
                    if (!face.IsVisible(viewDir))
                    {
                        continue;
                    }
                    // draw polygon
                    Point[] ptsFace = graphics.TransformPoint(face.Points);
                    g.FillPolygon(new SolidBrush(face.ColorGraph(graphics)), ptsFace);
                }
                catch (Exception /*ex*/)
                {
                }
            }
            // top
            double cosTop     = Math.Abs(Vector3D.DotProduct(HalfAxis.ToVector3D(Position.Direction), graphics.VLight));
            Color  colorTop   = Color.FromArgb((int)(Color.R * cosTop), (int)(Color.G * cosTop), (int)(Color.B * cosTop));
            Brush  brushTop   = new SolidBrush(colorTop);
            bool   topVisible = Vector3D.DotProduct(HalfAxis.ToVector3D(Position.Direction), viewDir) < 0;

            if (topVisible)
            {
                g.FillPolygon(brushTop, ptsTop);
            }
            else
            {
                g.FillPolygon(brushTop, ptsBottom);
            }
        }
Пример #22
0
 public override System.Drawing.Bitmap GetNext()
 {
     System.Drawing.Bitmap result;
     lock (this.newBitmap)
     {
         lock (this.oldBitmap)
         {
             if (this.nowState == MarqueeDisplayState.First)
             {
                 this.nowPosition = (int)this.nowPositionF;
                 int arg_51_0 = (this.newBitmap.Width - this.nowPosition) / 2;
                 System.Drawing.Bitmap   bitmap   = new System.Drawing.Bitmap(this.newBitmap);
                 System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap);
                 System.Drawing.Brush    brush    = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
                 this.GetLeft(this.nowPosition);
                 graphics.FillPolygon(brush, this.pointLeft);
                 graphics.FillPolygon(brush, this.pointRight);
                 brush.Dispose();
                 graphics.Dispose();
                 this.nowPositionF += this.step;
                 if (this.nowPosition >= this.newBitmap.Width / 2 + this.newBitmap.Height)
                 {
                     this.nowState = MarqueeDisplayState.Stay;
                 }
                 result = bitmap;
             }
             else if (this.nowState == MarqueeDisplayState.Stay)
             {
                 this.StayNum += 42;
                 if (this.StayNum > this.effect.Stay)
                 {
                     if (this.effect.ExitMode == 0)
                     {
                         result = null;
                         return(result);
                     }
                     this.nowState = MarqueeDisplayState.Exit;
                 }
                 result = new System.Drawing.Bitmap(this.newBitmap);
             }
             else
             {
                 result = this.Exit.GetNext();
             }
         }
     }
     return(result);
 }
Пример #23
0
 /// <summary>
 /// 绘制方法
 /// </summary>
 /// <param name="g">画布</param>
 /// <param name="center">地图中心点</param>
 /// <param name="zoom">地图缩放级别</param>
 /// <param name="screen_size">地图大小</param>
 public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size)
 {
     if (Points != null && Points.Count >= 2)
     {
         g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
         List <Point> l = new List <Point>();
         foreach (LatLngPoint p in Points)
         {
             l.Add(MapHelper.GetScreenLocationByLatLng(p, center, zoom, screen_size));
         }
         using (Pen pen = new Pen(Color.FromArgb(150, Color.Blue), 4))
         {
             if (Points.Count == 2)
             {
                 g.DrawLine(pen, l[0], l[1]);
             }
             else
             {
                 using (SolidBrush sb = new SolidBrush(Color.FromArgb(30, Color.Blue)))
                 {
                     g.FillPolygon(sb, l.ToArray());
                 }
                 g.DrawPolygon(pen, l.ToArray());
             }
         }
     }
 }
Пример #24
0
        /// <summary>
        /// Draw position marker
        /// </summary>
        /// <param name="grfx">The frame</param>
        /// <param name="time"></param>
        public override void Draw(Graphics grfx, float time)
        {
            // TODO: Add custom immage
            GPSData gps = GPSData.GetData();
            ProjectSettings settings = ProjectSettings.GetSettings();

            PointF position = gps.ToPixelCoordinate(gps.GetPosition(time), GetSize(), settings.WholeTrackLineWidth);
            position.X += GetPosition().X;
            position.Y = GetPosition().Y + position.Y;

            float size = settings.PositionMarkerSize;
            Vector[] coordinateSystem = gps.GetOrientation(time, size);

            Vector fwd = coordinateSystem[0];
            Vector side = coordinateSystem[1]; // perpendicular
            PointF[] markerPoints =
            {
                new PointF((float)fwd.X + position.X, -(float)fwd.Y + position.Y),
                new PointF((float)side.X / 3 + position.X, -(float)side.Y / 3 + position.Y),
                new PointF(-(float)side.X / 3 + position.X, +(float)side.Y / 3 + position.Y)
            };

            Brush brush = new SolidBrush(settings.PositionMarkerColor);
            grfx.FillPolygon(brush, markerPoints);
        }
Пример #25
0
        /// <summary>
        /// Renders the key in the specified surface.
        /// </summary>
        /// <param name="g">The GDI+ surface to render on.</param>
        /// <param name="scrollCount">The number of times the direction has been scrolled within the timeout.</param>
        public void Render(Graphics g, int scrollCount)
        {
            var pressed = scrollCount > 0;
            var style = GlobalSettings.CurrentStyle.TryGetElementStyle<KeyStyle>(this.Id)
                            ?? GlobalSettings.CurrentStyle.DefaultKeyStyle;
            var defaultStyle = GlobalSettings.CurrentStyle.DefaultKeyStyle;
            var subStyle = pressed ? style?.Pressed ?? defaultStyle.Pressed : style?.Loose ?? defaultStyle.Loose;

            var text = pressed ? scrollCount.ToString() : this.Text;
            var txtSize = g.MeasureString(text, subStyle.Font);
            var txtPoint = new TPoint(
                this.TextPosition.X - (int)(txtSize.Width / 2),
                this.TextPosition.Y - (int)(txtSize.Height / 2));

            // Draw the background
            var backgroundBrush = this.GetBackgroundBrush(subStyle, pressed);
            g.FillPolygon(backgroundBrush, this.Boundaries.ConvertAll<Point>(x => x).ToArray());

            // Draw the text
            g.SetClip(this.GetBoundingBox());
            g.DrawString(text, subStyle.Font, new SolidBrush(subStyle.Text), (Point)txtPoint);
            g.ResetClip();

            // Draw the outline.
            if (subStyle.ShowOutline)
                g.DrawPolygon(new Pen(subStyle.Outline, 1), this.Boundaries.ConvertAll<Point>(x => x).ToArray());
        }
Пример #26
0
 public static void RepertoryImage(Graphics drawDestination)
 {
     StringFormat itemStringFormat = new StringFormat();
     RectangleF itemBox = new RectangleF(5, 20, 70, 20);
     itemStringFormat.Alignment = StringAlignment.Center;
     drawDestination.DrawString("Message",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     if (mMscStyle == MscStyle.SDL){
         drawDestination.DrawLine(Pens.Black,5,55,40,55);
         drawDestination.DrawLine(Pens.Black,40,35,40,55);
         drawDestination.DrawLine(Pens.Black,40,35,75,35);
         PointF[] messagePolygon = new PointF[3];
         messagePolygon[0] = new PointF(5, 55);
         messagePolygon[1] = new PointF(5+8, 55-4);
         messagePolygon[2] = new PointF(5+8, 55+4);
         drawDestination.FillPolygon(Brushes.Black,messagePolygon);
     }
     else if(mMscStyle == MscStyle.UML2){
         drawDestination.DrawLine(Pens.Black,5,55,40,55);
         drawDestination.DrawLine(Pens.Black,40,35,40,55);
         drawDestination.DrawLine(Pens.Black,40,35,75,35);
         drawDestination.DrawLine(Pens.Black,5,55,5+8, 55-4);
         drawDestination.DrawLine(Pens.Black,5,55,5+8, 55+4);
     }
     itemStringFormat.Dispose();
 }
Пример #27
0
        //функција за испртување на скалилото
        public void Draw(Graphics g)
        {
            Point p1 = new Point(20, 200);
            Point p2 = new Point(20, 220);
            Point p3 = new Point(560, 220);
            Point p4 = new Point(560, 50);

            Point p7 = new Point(21, 200);
            Point p8 = new Point(21, 220);
            Point p5 = new Point(Xcoef, Ycoef);
            Point p6 = new Point(Xcoef, 220);

            Brush brush = new SolidBrush(Color.Black);
            Brush brush2 = new SolidBrush(Color);

            Pen pen = new Pen(brush);

            Point[] points1 = { p1, p2, p3, p4 };
            Point[] points2 = { p7, p8, p6, p5 };

            g.DrawPolygon(pen, points1);
            g.FillPolygon(brush2, points2);

            brush.Dispose();
            brush2.Dispose();
        }
Пример #28
0
 public override void DrawTo(Graphics graphics)
 {
     if (!ShouldDraw ())
         return;
     base.DrawTo (graphics);
     graphics.FillPolygon (BorderBrush, new[] { l, End, r, l });
 }
 public static void RepertoryImage(Graphics drawDestination)
 {
     StringFormat itemStringFormat = new StringFormat();
     RectangleF itemBox = new RectangleF(5, 15, 30, 15);
     RectangleF itemBox2 = new RectangleF(5, 35, 70, 15);
     itemStringFormat.Alignment = StringAlignment.Near;
     itemStringFormat.LineAlignment = StringAlignment.Near;
     PointF[] statePolygon = new PointF[5];
     statePolygon[0] = new PointF(5,15);
     statePolygon[1] = new PointF(40,15);
     statePolygon[2] = new PointF(40,25);
     statePolygon[3] = new PointF(35,30);
     statePolygon[4] = new PointF(5,30);
     drawDestination.FillPolygon(Brushes.White,statePolygon);
     drawDestination.DrawPolygon(Pens.LightGray,statePolygon);
     drawDestination.DrawRectangle(Pens.LightGray,5,15,70,50);
     drawDestination.DrawString("frag",new Font("Arial",8,FontStyle.Regular),Brushes.LightGray,itemBox,itemStringFormat);
     Pen rPen = new Pen(Color.Black);
     float[] pattern = {4f,4f};
     rPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
     rPen.DashPattern = pattern;
     itemStringFormat.Alignment = StringAlignment.Center;
     drawDestination.DrawString("separator",new Font("Arial",8,FontStyle.Italic),Brushes.Black,itemBox2,itemStringFormat);
     drawDestination.DrawLine(rPen, 5, 50, 75, 50);
     rPen.Dispose();
     itemStringFormat.Dispose();
 }
Пример #30
0
 public override void Draw(ref System.Drawing.Graphics g)
 {
     if (Nodes.Count != 0 && Check())
     {
         System.Drawing.Point[] PointArray = new System.Drawing.Point[Nodes.Count];
         for (int i = 0; i < Nodes.Count; i++)
         {
             PointArray[i] = CurrentLayer.CurrentMap.MapToScreen(Nodes[i]);
         }
         g.FillPolygon(Brush, PointArray);
         if (Selected)
         {
             Pen InvertPen = new Pen(Color.FromArgb(Pen.Color.A, 0xFF - Pen.Color.R, 0xFF - Pen.Color.G, 0xFF - Pen.Color.B), Pen.Width);
             InvertPen.DashStyle = Pen.DashStyle;
             g.DrawPolygon(InvertPen, PointArray);
         }
         else
         {
             g.DrawPolygon(Pen, PointArray);
         }
     }
     else
     {
         return;
     }
 }
Пример #31
0
		public override void Draw(Graphics graphics)
		{
			if (graphics == null) return;
			base.Draw(graphics);
			graphics.FillPolygon (fill , plusPoints);
			graphics.DrawPolygon (stroke, plusPoints);
		}
Пример #32
0
 public override System.Drawing.Bitmap GetNext()
 {
     if (this.nowState == MarqueeDisplayState.First)
     {
         this.nowPosition = (int)this.nowPositionF;
         int arg_2C_0 = (this.newBitmap.Width - this.nowPosition) / 2;
         System.Drawing.Bitmap   bitmap   = new System.Drawing.Bitmap(this.newBitmap);
         System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap);
         this.GetLeft(this.nowPosition);
         System.Drawing.SolidBrush solidBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Silver);
         System.Drawing.Bitmap     bitmap2    = new System.Drawing.Bitmap(this.newBitmap.Width, this.newBitmap.Height);
         System.Drawing.Graphics   graphics2  = System.Drawing.Graphics.FromImage(bitmap2);
         graphics2.Clear(System.Drawing.Color.Black);
         graphics2.FillPolygon(solidBrush, this.pointLeft);
         graphics2.Dispose();
         bitmap2.MakeTransparent(System.Drawing.Color.Silver);
         graphics.DrawImage(bitmap2, new System.Drawing.Point(0, 0));
         bitmap2.Dispose();
         solidBrush.Dispose();
         graphics.Dispose();
         this.nowPositionF -= this.step;
         if (this.nowPositionF <= 0f)
         {
             this.nowState = MarqueeDisplayState.Stay;
         }
         return(bitmap);
     }
     return(null);
 }
Пример #33
0
        public void draw(Graphics g)
        {
            SolidBrush brush = new SolidBrush(color);
            Point[] p = {p1, p2, p3 };

            g.FillPolygon(brush, p, System.Drawing.Drawing2D.FillMode.Alternate);
        }
Пример #34
0
        public static void DrawTrees(Graphics g, byte[,] effectValues, int tickCount)
        {
            using (var solidBrush = new SolidBrush(Color.Black)) {
                solidBrush.Color = Color.FromArgb(effectValues[0, tickCount], Color.Red);
                g.FillPolygon(solidBrush, new[] {new Point(22, 36), new Point(37, 91), new Point(7, 91)});

                solidBrush.Color = Color.FromArgb(effectValues[1, tickCount], Color.Green);
                g.FillPolygon(solidBrush, new[] {new Point(67, 36), new Point(82, 91), new Point(52, 91)});

                solidBrush.Color = Color.FromArgb(effectValues[2, tickCount], Color.Blue);
                g.FillPolygon(solidBrush, new[] {new Point(112, 36), new Point(127, 91), new Point(97, 91)});

                solidBrush.Color = Color.FromArgb(effectValues[3, tickCount], Color.White);
                g.FillPolygon(solidBrush, new[] {new Point(157, 36), new Point(172, 91), new Point(142, 91)});
            }
        }
Пример #35
0
        public override void Redraw(Graphics g)
        {
            if (txt == null)
                return;

            Point position = txt.GetPositionFromCharIndex(startIndex);
            Point centerPos = new Point(position.X, (int)(position.Y + (txt.Font.Size * 0.75)));
            float thirdFontSize = txt.Font.Size / 3;

            centerPos.Offset((int)thirdFontSize, 0);
            centerPos.Offset((int)thirdFontSize, 0);
            Brush brush = new SolidBrush(BrushColor);
            Pen pen = new Pen(brush);

            //the horizontal line
            Point lineEnd = new Point((int)(centerPos.X + thirdFontSize), centerPos.Y);
            g.DrawLine(pen, centerPos, lineEnd);

            //the verical line from top
            PointF verticalLineStart = new PointF(lineEnd.X, (lineEnd.Y - thirdFontSize));
            g.DrawLine(pen, verticalLineStart, lineEnd);

            //the arrow on the left pointing left
            PointF topArrowHead = new PointF(centerPos.X, (centerPos.Y - thirdFontSize));
            PointF bottomArrowHead = new PointF(centerPos.X, (centerPos.Y + thirdFontSize));
            PointF middleArrowHead = new PointF(centerPos.X - thirdFontSize, centerPos.Y);

            g.DrawPolygon(pen, new PointF[] { topArrowHead, bottomArrowHead, middleArrowHead });
            g.FillPolygon(brush, new PointF[] { topArrowHead, bottomArrowHead, middleArrowHead });
        }
Пример #36
0
Файл: Star.cs Проект: AtanasK/VP
 public override void Draw(Graphics g)
 {
     Brush brush = new SolidBrush(Color.Yellow);
     Rectangle rect = new Rectangle(Position.X - WIDTH / 2, Position.Y - WIDTH / 2, WIDTH,WIDTH);
     g.FillPolygon(brush, StarPoints(5, rect));
     brush.Dispose();
 }
Пример #37
0
		public void DrawGlyph(Graphics g)
		{
			if (isMouseOver)
			{
				Color fill = renderer.ColorTable.ButtonSelectedHighlight; //Color.FromArgb(35, SystemColors.Highlight);
				g.FillRectangle(new SolidBrush(fill), glyphRect);
				Rectangle borderRect = glyphRect;

				borderRect.Width--;
				borderRect.Height--;

				g.DrawRectangle(SystemPens.Highlight, borderRect);
			}

			SmoothingMode bak = g.SmoothingMode;

			g.SmoothingMode = SmoothingMode.Default;

			using (Pen pen = new Pen(Color.Black))
			{
				pen.Width = 2;

				g.DrawLine(pen, new Point(glyphRect.Left + (glyphRect.Width / 3) - 2, glyphRect.Height / 2 - 1),
					new Point(glyphRect.Right - (glyphRect.Width / 3), glyphRect.Height / 2 - 1));
			}

			g.FillPolygon(Brushes.Black, new Point[]{
                new Point(glyphRect.Left + (glyphRect.Width / 3)-2, glyphRect.Height / 2+2),
                new Point(glyphRect.Right - (glyphRect.Width / 3), glyphRect.Height / 2+2),
                new Point(glyphRect.Left + glyphRect.Width / 2-1,glyphRect.Bottom-4)});

			g.SmoothingMode = bak;
		}
        public override void OnRender(Graphics g)
        {
            #if !PocketPC
             if(!Bearing.HasValue)
             {
            g.DrawImageUnscaled(Resources.shadow50, LocalPosition.X, LocalPosition.Y);
             }
             g.TranslateTransform(ToolTipPosition.X, ToolTipPosition.Y);

             if(Bearing.HasValue)
             {
            g.RotateTransform(Bearing.Value - Overlay.Control.Bearing);
            g.FillPolygon(Brushes.Lime, Arrow);
             }

             g.ResetTransform();

             if(!Bearing.HasValue)
             {
            g.DrawImageUnscaled(Resources.bigMarkerGreen, LocalPosition.X, LocalPosition.Y);
             }
            #else
            DrawImageUnscaled(g, Resources.shadow50, LocalPosition.X, LocalPosition.Y);
            DrawImageUnscaled(g, Resources.marker, LocalPosition.X, LocalPosition.Y);
            #endif
        }
Пример #39
0
        public void DrawGlyph(Graphics g)
        {
            if (isMouseOver)
              {
            gbrush = new LinearGradientBrush(glyphRect, Color.White, Color.FromArgb(224, 221, 206), LinearGradientMode.Vertical);
            g.FillRectangle(gbrush, glyphRect);
            Rectangle borderRect = glyphRect;

            borderRect.Width--;
            borderRect.Height--;

            g.DrawRectangle(new Pen(Color.Silver), borderRect);
              }

              g.SmoothingMode = SmoothingMode.Default;

              using (Pen pen = new Pen(Color.Gray))
              {
            pen.Width = 2;

            g.DrawLine(pen, new Point(glyphRect.Left + (glyphRect.Width / 3) - 2, glyphRect.Height / 2 - 1),
            new Point(glyphRect.Right - (glyphRect.Width / 3), (glyphRect.Height / 2) -1));
              }

              g.FillPolygon(Brushes.Black, new Point[]{
                new Point(glyphRect.Left + (glyphRect.Width / 3)-2, glyphRect.Height / 2+2),
                new Point(glyphRect.Right - (glyphRect.Width / 3), glyphRect.Height / 2+2),
                new Point(glyphRect.Left + glyphRect.Width / 2-1,glyphRect.Bottom-4)});
        }
Пример #40
0
 public static void RepertoryImage(Graphics drawDestination, MscStyle style)
 {
     StringFormat itemStringFormat = new StringFormat();
     RectangleF itemBox = new RectangleF(10, 20, 60, 20);
     float[] pattern = {4f,4f};
     Pen rPen = new Pen(Color.Black);
     rPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
     rPen.DashPattern = pattern;
     itemStringFormat.Alignment = StringAlignment.Center;
     itemStringFormat.LineAlignment = StringAlignment.Center;
     drawDestination.DrawLine(Pens.LightGray,10,10,10,70);
     drawDestination.DrawLine(Pens.LightGray,55,50,55,70);
     drawDestination.DrawLine(Pens.Black,10,45,40,45);
     if (style==MscStyle.SDL){
         PointF[] messagePolygon = new PointF[3];
         messagePolygon[0] = new PointF(40, 45);
         messagePolygon[1] = new PointF(40-8, 45-4);
         messagePolygon[2] = new PointF(40-8, 45+4);
         drawDestination.FillPolygon(Brushes.Black,messagePolygon);
     }
     else if (style==MscStyle.UML2){
         drawDestination.DrawLine(Pens.Black,40, 45,40-8, 45-4);
         drawDestination.DrawLine(Pens.Black,40, 45,40-8, 45+4);
     }
     drawDestination.DrawRectangle(Pens.Black, 40,40,30,10);
     drawDestination.DrawString("Create",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     rPen.Dispose();
     itemStringFormat.Dispose();
 }
Пример #41
0
        public override void DrawSelf(Graphics gfx, Pen pen)
        {
            base.DrawSelf(gfx, pen);

            PointF a = new PointF(Center.X + Width / 2, Center.Y);
            PointF b = new PointF(Center.X - Width / 2, Center.Y + Height / 2);
            PointF c = new PointF(Center.X - Width / 2, Center.Y - Height / 2);

            PointF a1 = Calc.RotatePoint(Center, a, Angle);
            PointF b1 = Calc.RotatePoint(Center, b, Angle);
            PointF c1 = Calc.RotatePoint(Center, c, Angle);

            Brush brush = Brushes.Blue;
            gfx.FillPolygon(brush, new PointF[4] { a1, b1, c1, a1 });
            gfx.DrawPolygon(pen, new PointF[4] { a1, b1, c1, a1 });

            if (!Dummy)
            {

                Pen penn = new Pen(Color.LightBlue, 1);
                gfx.DrawEllipse(penn, Center.X - Range, Center.Y - Range, Range * 2, Range * 2);
            }
            if (Dummy)
            {
                gfx.DrawString((1000 / FireDelayMilis * TeslaBullet.DamageDefault).ToString(), new Font("Arial", 7), Brushes.Black, Center.X - (Width / 2), Center.Y - 15);
            }
        }
Пример #42
0
 public void Draw(Graphics graphics, int offsetX, int offsetY)
 {
     int avgX = (int)Points.Average(x => x.X);
     int avgY = (int)Points.Average(x => x.Y);
     var offsetPoints = Points.Select(x => new Point(x.X + offsetX - avgX, x.Y + offsetY - avgY)).ToArray();
     graphics.FillPolygon(new SolidBrush(Color), offsetPoints);
 }
Пример #43
0
 public override void Draw(Graphics g)
 {
     if (Game.DebugView)
     {
         g.FillPolygon(new SolidBrush(Color.FromArgb(100, Color.Green)), Vector2.ToPointArray(Vectors));
     }
 }
        public void FillPolygon(IEnumerable <Point> points, Color color)
        {
            var pointsF = points.Select(p => p.ToPointF()).ToArray();

            using (var brush = new SolidBrush(color.ToColor()))
            {
                m_Graphics.FillPolygon(brush, pointsF);
            }
        }
Пример #45
0
        /// <summary>
        /// Renders the lane splint
        /// </summary>
        /// <param name="g"></param>
        /// <param name="t"></param>
        /// <remarks>TODO: set lane spline</remarks>
        public void Render(System.Drawing.Graphics g, WorldTransform t)
        {
            Color c = DrawingUtility.ColorArbiterLaneSpline;

            if (DrawingUtility.DisplayArbiterLanes)
            {
                Coordinates cp = t.GetWorldPoint(new PointF(t.ScreenSize.Width / 2, t.ScreenSize.Height / 2));
                Coordinates lp = this.LanePath().GetClosestPoint(cp).Location;
                string      s  = this.LaneId.ToString();
                DrawingUtility.DrawControlLabel(lp, Color.DarkBlue, s, ContentAlignment.MiddleCenter, ControlPointStyle.None, g, t);
            }

            bool displayPolygon = false;

            switch (this.LaneId.Number)
            {
            case 1:
                displayPolygon = DrawingUtility.DisplayArbiterLanePolygon1;
                break;

            case 2:
                displayPolygon = DrawingUtility.DisplayArbiterLanePolygon2;
                break;

            case 3:
                displayPolygon = DrawingUtility.DisplayArbiterLanePolygon3;
                break;

            case 4:
                displayPolygon = DrawingUtility.DisplayArbiterLanePolygon4;
                break;
            }

            if (displayPolygon && this.LanePolygon != null)
            {
                // show intersection polygon
                HatchBrush hBrush1 = new HatchBrush(HatchStyle.ForwardDiagonal, DrawingUtility.ColorArbiterLanePolygon, Color.White);

                // populate polygon
                List <PointF> polyPoints = new List <PointF>();
                foreach (Coordinates lpp in this.LanePolygon.points)
                {
                    polyPoints.Add(DrawingUtility.ToPointF(lpp));
                }

                // draw poly and fill
                g.FillPolygon(hBrush1, polyPoints.ToArray());

                DrawingUtility.DrawControlPolygon(this.LanePolygon, DrawingUtility.ColorArbiterLanePolygon, System.Drawing.Drawing2D.DashStyle.Solid, g, t);
            }

            if (DrawingUtility.DisplayArbiterLanePath)
            {
                DrawingUtility.DrawControlLine(this.laneLinePath, g, t, new Pen(Color.MediumVioletRed), Color.MediumVioletRed);
            }
        }
Пример #46
0
        public void Draw(System.Drawing.Graphics g, System.Drawing.Brush b, Ratchet.Math.mat4 model, Ratchet.Math.mat4 view, Ratchet.Math.mat4 projection)
        {
            Triangle3 t = (projection * (view * (model * this)));

            Ratchet.Math.vec2 p1 = new Ratchet.Math.vec2(t.p1.x / t.p1.z, -t.p1.y / t.p1.z);
            Ratchet.Math.vec2 p2 = new Ratchet.Math.vec2(t.p2.x / t.p2.z, -t.p2.y / t.p2.z);
            Ratchet.Math.vec2 p3 = new Ratchet.Math.vec2(t.p3.x / t.p3.z, -t.p3.y / t.p3.z);

            g.FillPolygon(b, new PointF[] { new PointF((p1.x + 1.0f) * (640 / 2), (p1.y + 1.0f) * (480 / 2)), new PointF((p2.x + 1.0f) * (640 / 2), (p2.y + 1.0f) * (480 / 2)), new PointF((p3.x + 1.0f) * (640 / 2), (p3.y + 1.0f) * (480 / 2)) });
        }
Пример #47
0
 public override void Draw(Graphics2D graphics)
 {
     System.Drawing.Graphics g = graphics.Graphics;
     // get points
     Point[] ptOuter = graphics.TransformPoint(MaxRadiusPoints);
     // max radius / top view
     g.FillPolygon(new SolidBrush(Color), ptOuter);
     // bottom (draw only path)
     g.DrawPolygon(new Pen(new SolidBrush(ColorPath)), ptOuter);
 }
Пример #48
0
        public void Render(System.Drawing.Graphics g, WorldTransform t)
        {
            // show intersection safetyzone if supposed to show safety zone (polygon red hatch)
            if (DrawingUtility.DrawArbiterSafetyZones)
            {
                // show intersection polygon
                HatchBrush hBrush1 = new HatchBrush(HatchStyle.ForwardDiagonal, DrawingUtility.ColorArbiterSafetyZone, Color.White);

                // populate polygon
                List <PointF> polyPoints = new List <PointF>();
                foreach (Coordinates c in this.IntersectionPolygon.points)
                {
                    polyPoints.Add(DrawingUtility.ToPointF(c));
                }

                // draw poly and fill
                g.FillPolygon(hBrush1, polyPoints.ToArray());
            }

            // render stopped exits
            foreach (ArbiterStoppedExit ase in this.StoppedExits)
            {
                ase.Render(g, t);
            }

            // draw intersection polygon
            DrawingUtility.DrawControlPolygon(this.IntersectionPolygon,
                                              DrawingUtility.ColorArbiterIntersection,
                                              DashStyle.DashDotDot,
                                              g, t);

            // show incoming lane points (disjoint from exits)
            foreach (KeyValuePair <ArbiterLane, LinePath.PointOnPath> pop in this.IncomingLanePoints)
            {
                DrawingUtility.DrawControlPoint(pop.Key.LanePath().GetPoint(pop.Value), DrawingUtility.ColorArbiterIntersectionIncomingLanePoints, null,
                                                ContentAlignment.MiddleCenter, ControlPointStyle.SmallX, g, t);
            }

            // show all entries
            foreach (ITraversableWaypoint aw in this.AllEntries.Values)
            {
                DrawingUtility.DrawControlPoint(aw.Position, DrawingUtility.ColorArbiterIntersectionEntries, null,
                                                ContentAlignment.MiddleCenter, ControlPointStyle.LargeCircle, g, t);
            }

            // show all exits
            foreach (ITraversableWaypoint aw in this.AllExits.Values)
            {
                DrawingUtility.DrawControlPoint(aw.Position, DrawingUtility.ColorArbiterIntersectionExits, null,
                                                ContentAlignment.MiddleCenter, ControlPointStyle.LargeCircle, g, t);
            }

            // draw center point
            DrawingUtility.DrawControlPoint(this.Center, DrawingUtility.ColorArbiterIntersection, null, ContentAlignment.MiddleCenter, ControlPointStyle.LargeX, g, t);
        }
Пример #49
0
 public override void Paint(System.Drawing.Graphics g)
 {
     getVertex();
     Point[] p = new Point[4];
     for (int i = 0; i < p.Length; ++i)
     {
         p[i] = new Point(point.X + vertex[i].X, point.Y + vertex[i].Y);
     }
     g.FillPolygon(brush, p);
     g.DrawPolygon(pen, p);
 }
Пример #50
0
        public override void RealRenderSG(System.Drawing.Graphics g)
        {
            if (Camera.IsRendererOutOfScreen(this))
            {
                return;
            }
            Vector2 screenPos = Camera.WorldToScreenPosition(gameObject.transform.position);
            Brush   b         = new SolidBrush(color);

            g.FillPolygon(b, BuildPointFArray());
        }
Пример #51
0
        public void DrawCylinder(Cylinder cyl)
        {
            System.Drawing.Graphics g = Graphics;

            // get points
            Point[] ptOuter = TransformPoint(cyl.TopPoints);
            Point[] ptInner = TransformPoint(cyl.TopPointsInner);
            // top color
            Brush brushSolid = new SolidBrush(cyl.ColorTop);

            g.FillPolygon(brushSolid, ptOuter);
            // hole -> drawing polygon with background color
            Brush brushBackground = new SolidBrush(ColorBackground);

            g.FillPolygon(brushBackground, ptInner);
            // bottom (draw only path)
            Brush brushPath = new SolidBrush(cyl.ColorPath);
            Pen   penPath   = new Pen(brushPath);

            g.DrawPolygon(penPath, ptOuter);
        }
 public override void Paint(System.Drawing.Graphics g)
 {
     if (nSide < 0 || radius < 0)
     {
         throw new Exception("Uncorrect Data");
     }
     else
     {
         p = new PointF[nSide];
         SearchPoint((float)360 / nSide);
         g.DrawPolygon(pen, p);
         g.FillPolygon(brush, p);
     }
 }
Пример #53
0
    public static string createModel(String[] array)
    {
        if (array.Length > 0)
        {
            System.Drawing.Bitmap   bm = new System.Drawing.Bitmap(400, array.Length * 90);
            System.Drawing.Graphics g  = System.Drawing.Graphics.FromImage(bm);
            g.Clear(System.Drawing.Color.White);
            int x = 100;
            int y = 10;
            System.Drawing.StringFormat f = new System.Drawing.StringFormat();
            f.Alignment     = System.Drawing.StringAlignment.Center;
            f.LineAlignment = System.Drawing.StringAlignment.Center;
            System.Drawing.Font font;
            System.Drawing.Drawing2D.LinearGradientBrush b = new System.Drawing.Drawing2D.LinearGradientBrush(new System.Drawing.Point(0, 40), new System.Drawing.Point(30, 130), System.Drawing.Color.GreenYellow, System.Drawing.Color.LemonChiffon);
            for (int i = 0; i < array.Length; i++)
            {
                font = new System.Drawing.Font("Arial Unicode MS", 10, System.Drawing.FontStyle.Regular);
                g.DrawImageUnscaled(System.Drawing.Image.FromFile(HttpContext.Current.Request.MapPath("tskOval.png")), x, y);
                g.DrawString(array[i].Substring(0, (array[i].Length > 52 ? 52 : array[i].Length)), font, System.Drawing.Brushes.Black, new System.Drawing.Rectangle(x + 30, y + 6, 172, 40), f);
                y += 85;
            }

            x = 100;
            y = 10;
            int y1, y2;
            for (int i = 1; i < array.Length; i++)
            {
                System.Drawing.Pen p = new System.Drawing.Pen(System.Drawing.Color.Black);
                p.Width = 1.5F;
                y1      = (((i) * 50) + y + ((i - 1) * 35));
                y2      = (((i) * 50) + y + ((i) * 35));
                g.DrawLine(p, 200, y1 + 2, 200, y2);
                System.Drawing.Point[] pns = new System.Drawing.Point[4];
                pns[0] = new System.Drawing.Point(195, y2 - 5);
                pns[1] = new System.Drawing.Point(200, y2);
                pns[2] = new System.Drawing.Point(205, y2 - 5);
                pns[3] = new System.Drawing.Point(195, y2 - 5);
                g.FillPolygon(System.Drawing.Brushes.Black, pns);

                // g.DrawString(((Node)SessionClass.Flow[i-1]).decision.Equals("True")?"Yes":"No", new System.Drawing.Font("Arial Unicode MS", 9, System.Drawing.FontStyle.Regular), System.Drawing.Brushes.Black, new System.Drawing.Point(205, y1 +6));
            }
            string res = HttpContext.Current.Server.MapPath("Results") + "\\User" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".png";
            bm.Save(res, System.Drawing.Imaging.ImageFormat.Png);
            return("Results/" + res.Replace(HttpContext.Current.Server.MapPath("Results") + "\\", ""));
        }
        else
        {
            return("");
        }
    }
Пример #54
0
 public override System.Drawing.Bitmap GetNext()
 {
     if (this.nowState == MarqueeDisplayState.First)
     {
         this.nowPosition = (int)this.nowPositionF;
         int arg_2C_0 = (this.newBitmap.Width - this.nowPosition) / 2;
         System.Drawing.Bitmap   bitmap   = new System.Drawing.Bitmap(this.newBitmap);
         System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap);
         System.Drawing.Brush    brush    = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
         this.GetLeft(this.nowPosition);
         graphics.FillPolygon(brush, this.pointLeft);
         graphics.FillPolygon(brush, this.pointRight);
         brush.Dispose();
         graphics.Dispose();
         this.nowPositionF -= this.step;
         if (this.nowPosition <= 0)
         {
             this.nowState = MarqueeDisplayState.Stay;
         }
         return(bitmap);
     }
     return(null);
 }
Пример #55
0
        public override void Draw(Graphics2D graphics)
        {
            System.Drawing.Graphics g = graphics.Graphics;
            Pen penPath = new Pen(new SolidBrush(TopFace.ColorPath));

            // get points
            Point[] pt = graphics.TransformPoint(TopFace.Points);

            // draw solid face
            Brush brushSolid = new SolidBrush(TopFace.ColorFill);

            g.FillPolygon(brushSolid, pt);
            g.DrawPolygon(penPath, pt);
            // draw box tape
            if (TapeWidth.Activated)
            {
                // instantiate brush
                Brush brushTape = new SolidBrush(TapeColor);
                // fill polygon
                Point[] pts = graphics.TransformPoint(TapePoints);
                g.FillPolygon(brushTape, pts);
                g.DrawPolygon(penPath, pts);
            }
        }
Пример #56
0
        public override void Draw(Graphics2D graphics)
        {
            System.Drawing.Graphics g = graphics.Graphics;

            // get points
            Point[] ptOuter = graphics.TransformPoint(TopPoints);;
            Point[] ptInner = graphics.TransformPoint(TopPointsInner);;

            // top color
            Brush brushSolid = new SolidBrush(ColorTop);

            g.FillPolygon(brushSolid, ptOuter);
            if (null != ptInner)
            {
                // hole -> drawing polygon with background color
                Brush brushBackground = new SolidBrush(graphics.ColorBackground);
                g.FillPolygon(brushBackground, ptInner);
            }
            // bottom (draw only path)
            Brush brushPath = new SolidBrush(ColorPath);
            Pen   penPath   = new Pen(brushPath);

            g.DrawPolygon(penPath, ptOuter);
        }
Пример #57
0
        public void DrawCylinder(Cylinder cyl)
        {
            System.Drawing.Graphics g = Graphics;

            // get points
            Point[] pt = TransformPoint(cyl.TopPoints);
            // bottom (draw only path)
            Brush brushSolid = new SolidBrush(cyl.ColorTop);

            g.FillPolygon(brushSolid, pt);
            Brush brushPath = new SolidBrush(cyl.ColorPath);
            Pen   penPath   = new Pen(brushPath);

            g.DrawPolygon(penPath, pt);
        }
        /// <summary>
        /// Draw Triangle
        /// </summary>
        /// <param name="G">Set Graphics</param>
        /// <param name="Rect">Set Rectangle</param>
        /// <param name="D">Set Direction</param>
        /// <param name="C">Set Color</param>
        public static void DrawTriangle(this System.Drawing.Graphics G, Rectangle Rect, Direction D, Color C)
        {
            int   halfWidth  = Rect.Width / 2;
            int   halfHeight = Rect.Height / 2;
            Point p0         = Point.Empty;
            Point p1         = Point.Empty;
            Point p2         = Point.Empty;

            switch (D)
            {
            case Direction.Up:
                p0 = new Point(Rect.Left + halfWidth, Rect.Top);
                p1 = new Point(Rect.Left, Rect.Bottom);
                p2 = new Point(Rect.Right, Rect.Bottom);

                break;

            case Direction.Down:
                p0 = new Point(Rect.Left + halfWidth, Rect.Bottom);
                p1 = new Point(Rect.Left, Rect.Top);
                p2 = new Point(Rect.Right, Rect.Top);

                break;

            case Direction.Left:
                p0 = new Point(Rect.Left, Rect.Top + halfHeight);
                p1 = new Point(Rect.Right, Rect.Top);
                p2 = new Point(Rect.Right, Rect.Bottom);

                break;

            case Direction.Right:
                p0 = new Point(Rect.Right, Rect.Top + halfHeight);
                p1 = new Point(Rect.Left, Rect.Bottom);
                p2 = new Point(Rect.Left, Rect.Top);

                break;
            }

            using (SolidBrush B = new SolidBrush(C))
            {
                G.FillPolygon(B, new Point[] {
                    p0,
                    p1,
                    p2
                });
            }
        }
        public void Render(System.Drawing.Graphics g, WorldTransform t)
        {
            // show stopped exits (blue diags)
            HatchBrush hBrush1 = new HatchBrush(HatchStyle.ForwardDiagonal, DrawingUtility.ColorArbiterIntersectionStoppedExit, Color.White);

            // populate polygon
            List <PointF> polyPoints = new List <PointF>();

            foreach (Coordinates c in this.ExitPolygon.points)
            {
                polyPoints.Add(DrawingUtility.ToPointF(c));
            }

            // draw poly and fill
            g.FillPolygon(hBrush1, polyPoints.ToArray());
        }
Пример #60
0
        public void FillPolygon(IList <Point> Points, ILineStyleInfo LineStyle, IFillStyleInfo FillStyle)
        {
            GDIPlusLineStyle Line = (GDIPlusLineStyle)LineStyle;
            GDIPlusFillStyle Fill = (GDIPlusFillStyle)FillStyle;

            System.Drawing.Point[] P = new System.Drawing.Point[Points.Count];

            for (int i = 0; i < Points.Count; i++)
            {
                P[i].X = Points[i].X;
                P[i].Y = Points[i].Y;
            }

            mGraphics.FillPolygon(Fill.Brush, P);
            mGraphics.DrawPolygon(Line.Pen, P);
        }