コード例 #1
0
        public void FillPolygon(Polygon poly)
        {
            var s = GetNextShape(TypeId.Polygon);
            var e = (NativePolygon)s.Element;

            var n = poly.Points.Count;

            if (n == 0)
            {
                return;
            }

            var p0 = poly.Points[0];
            var p1 = poly.Points[1];

            if ((s.Count != n) || (p0.X != s.X) || (p0.Y != s.Y) || (p1.X != s.Width) || (p1.Y != s.Height))
            {
                s.Count  = n;
                s.X      = p0.X;
                s.Y      = p0.Y;
                s.Width  = p1.X;
                s.Height = p1.Y;

                var ps = new PointCollection();
                for (var i = 0; i < n; i++)
                {
                    ps.Add(new Point(poly.Points[i].X, poly.Points[i].Y));
                }
                e.Points = ps;
            }

            if (s.Color != _currentColor || s.DrawOp != DrawOp.Fill)
            {
                s.Color  = _currentColor;
                s.DrawOp = DrawOp.Fill;
                e.Fill   = _currentColor.GetBrush();
                e.Stroke = null;
            }
        }
コード例 #2
0
        public void FillPolygon(Polygon poly)
        {
            var g = poly.GetGeometry(d2dFactory);

            dc.FillGeometry(g, lastColor.GetBrush(dc));
        }