当前位置: 首页>>代码示例>>C#>>正文


C# Graphics.FillPolygon方法代码示例

本文整理汇总了C#中System.Drawing.Graphics.FillPolygon方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.FillPolygon方法的具体用法?C# Graphics.FillPolygon怎么用?C# Graphics.FillPolygon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.Graphics的用法示例。


在下文中一共展示了Graphics.FillPolygon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawBrick

		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);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:7,代码来源:MethodShape.cs

示例2: RepertoryImage

        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();
        }
开发者ID:xueliu,项目名称:MSC_Generator,代码行数:31,代码来源:LostMessageExtension.cs

示例3: Draw

		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));
		}
开发者ID:froggy96,项目名称:diagramnet,代码行数:28,代码来源:CommentBoxElement.cs

示例4: DrawIsometricView

        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);
        }
开发者ID:mono,项目名称:sysdrawing-coregraphics,代码行数:29,代码来源:DrawCylinder.cs

示例5: drawBattleDice

        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;
        }
开发者ID:nullcat,项目名称:A-Dicey-Story,代码行数:35,代码来源:FormBattle.cs

示例6: Draw

        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);
            }
        }
开发者ID:NeuroRoboticTech,项目名称:AnimatLabPublicSource,代码行数:33,代码来源:KeyFrameCurrent.cs

示例7: Draw

		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);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:8,代码来源:EventShape.cs

示例8: RepertoryImage

 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();
 }
开发者ID:xueliu,项目名称:MSC_Generator,代码行数:57,代码来源:MessageExtension.cs

示例9: Draw

        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);
        }
开发者ID:xs2ranjeet,项目名称:13ns9-1spr,代码行数:10,代码来源:Cub.cs

示例10: Form1_Paint

        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);
        }
开发者ID:Temirbay,项目名称:Projects,代码行数:55,代码来源:Form1.cs

示例11: Draw

        /// <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);
        }
开发者ID:shujaatak,项目名称:PrimaryFlightDisplay,代码行数:14,代码来源:CenterIndicator.cs

示例12: DrawBone

        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));
                }

            }
        }
开发者ID:Worlaf,项目名称:BAnimator,代码行数:49,代码来源:BoneDrawer.cs

示例13: RepertoryImage

 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();
 }
开发者ID:xueliu,项目名称:MSC_Generator,代码行数:27,代码来源:InLineSeperatorExtension.cs

示例14: DrawGlyph

		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;
		}
开发者ID:superyfwy,项目名称:db4o,代码行数:33,代码来源:OMETabStripMenuGlyph.cs

示例15: Draw

 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();
 }
开发者ID:AtanasK,项目名称:VP,代码行数:7,代码来源:Star.cs


注:本文中的System.Drawing.Graphics.FillPolygon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。