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


C# Graphics.DrawPolygon方法代码示例

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


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

示例1: DoPage

    protected override void DoPage(Graphics grfx, Color clr, int cx, int cy)
    {
        Pen pen = new Pen(clr);
        Brush brush = new SolidBrush(clr);
        const int xOffset = 10;
        const int yOffset = 10;

        grfx.DrawPolygon(pen, new PointF[]
            {
                MMConv(grfx, new PointF(xOffset, yOffset)),
                MMConv(grfx, new PointF(xOffset+100, yOffset)),
                MMConv(grfx, new PointF(xOffset+100, yOffset+10)),
                MMConv(grfx, new PointF(xOffset, yOffset+10))
            });
        StringFormat strfmt = new StringFormat();
        strfmt.Alignment = StringAlignment.Center;

        for (int i=1; i<100; i++)
        {
            if (i%10 == 0)
            {
                grfx.DrawLine(pen,
                    MMConv(grfx, new PointF(xOffset+i, yOffset)),
                    MMConv(grfx, new PointF(xOffset+i, yOffset+5)));

                grfx.DrawString((i/10).ToString(), Font, brush,
                    MMConv(grfx, new PointF(xOffset+i, yOffset+5)),
                    strfmt);
            }
            else if (i%5 == 0)
            {
                grfx.DrawLine(pen,
                    MMConv(grfx, new PointF(xOffset+i, yOffset)),
                    MMConv(grfx, new PointF(xOffset+i, yOffset+3)));
            }
            else
            {
                grfx.DrawLine(pen,
                    MMConv(grfx, new PointF(xOffset+i, yOffset)),
                    MMConv(grfx, new PointF(xOffset+i, yOffset+2.5f)));
            }

        }
    }
开发者ID:dbremner,项目名称:hycs,代码行数:44,代码来源:ruler.cs

示例2: Render

        public override void Render(Graphics gr, int iScale)
        {
            Point[] points = new Point[m_iNumPoints];

            int iRad = m_iVertexRadius * iScale;
            for (int i = 0; i < m_iNumPoints; ++i)
            {
                points[i].X = (m_iXStart * iScale) + iRad + (int)(Math.Sin(2 * i * Math.PI / m_iNumPoints + m_dRotation) * iRad);
                points[i].Y = (m_iYStart * iScale) + iRad - (int)(Math.Cos(2 * i * Math.PI / m_iNumPoints + m_dRotation) * iRad);
            }
            gr.FillPolygon(new SolidBrush(m_Color), points);
            if (m_iBorderThickness > 0)
                gr.DrawPolygon(new Pen(m_BorderColor, m_iBorderThickness), points);
        }
开发者ID:NigelColpitts,项目名称:GDIDrawer,代码行数:14,代码来源:CDrawer.cs

示例3: Draw

		// Draw this path object.
		public override void Draw(Graphics graphics, Pen pen)
				{
					graphics.DrawPolygon(pen, points);
				}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:5,代码来源:GraphicsPath.cs


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