Добрый день! Есть код который красить определенную область. Хочу выделить её по контуру но выделяется не верно.
static void init(ref int[] a, ref int[] b, PaintEventArgs e, int i3,int R,int G,int B)
{
using (Matrix m = new Matrix())
{
m.Scale(2, 2);
e.Graphics.Transform = m;
List<Point> polyPoints = new List<Point>();
for (int i = 0; i < a.Length; i++)
{
// int x1 = Convert.ToInt32(textBox1.Text); int x2 = Convert.ToInt32(textBox1.Text);
//polyPoints.Add(new Point(Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text)));
polyPoints.Add(new Point(a[i], b[i]));
// use a semi-transparent background brush:
using (SolidBrush br = new SolidBrush(Color.FromArgb(R, G, B)))
{
e.Graphics.FillPolygon(br, polyPoints.ToArray());
}
// e.Graphics.DrawPolygon(Pens.DarkBlue, polyPoints.ToArray());
if (i == 0)
{
e.Graphics.DrawLine(Pens.Red, polyPoints[0].X, polyPoints[0].Y, polyPoints.Last().X, polyPoints.Last().Y);
}
else
{
e.Graphics.DrawLine(Pens.Red, polyPoints[i].X, polyPoints[i].Y, polyPoints[i - 1].X, polyPoints[i - 1].Y);
}
}
}
}
}
Вот здесь вырисовывается область
using (SolidBrush br = new SolidBrush(Color.FromArgb(R, G, B)))
{
e.Graphics.FillPolygon(br, polyPoints.ToArray());
}
А здесь Контур
if (i == 0)
{
e.Graphics.DrawLine(Pens.Red, polyPoints[0].X, polyPoints[0].Y, polyPoints.Last().X, polyPoints.Last().Y);
}
else
{
e.Graphics.DrawLine(Pens.Red, polyPoints[i].X, polyPoints[i].Y, polyPoints[i - 1].X, polyPoints[i - 1].Y);
}
}
Мне нужно чтобы контур выделялся четко по все области,но этого не происходит. Как можно без помощи Полигона залить цветом область внутри DrawLine?