예제 #1
0
        private void InitFigure()
        {
            graph = new Graph(
                picture.Width, picture.Height,
                Color.FromArgb(MyRegistry.LoadValue("background", Color.Black.ToArgb())),
                Color.FromArgb(MyRegistry.LoadValue("foreground", Color.White.ToArgb())));

            Figure.InitMinMax(0, 0, graph.bmp.Width, graph.bmp.Height);
            int points = MyRegistry.LoadValue("points", 4);

            p = new Polygone();
            for (int j = 0; j < points; j++)
            {
                p.AddFigure(Figure.RandomFigure());
            }
            timer.Enabled = true;
            TopMost       = true;
        }
예제 #2
0
        public void Draw(Polygone polygone, Pen pen)
        {
            Figure f1 = null;

            foreach (Figure f2 in polygone.list)
            {
                if (f1 != null)
                {
                    DrawLine(pen, f1.GetPixel(), f2.GetPixel());
                }
                f1 = f2;
            }
            if (polygone.list.Count > 2)
            {
                DrawLine(pen,
                         polygone.list[0].GetPixel(),
                         polygone.list[polygone.list.Count - 1].GetPixel());
            }
        }
예제 #3
0
 public void Erase(Polygone polygone)
 {
     Draw(polygone, penBack);
 }
예제 #4
0
 public void Draw(Polygone polygone)
 {
     Draw(polygone, penFore);
 }