Exemple #1
0
        private void ImageDrawingRepeat(ImageDrawing id)
        {
            Action <int> iAction = (i) => {
                for (int j = 0; j < 100; j++)
                {
                    id.DrawCircle(Color.Lime, j, i, 1, false);
                    id.DrawSquare(Color.Lime, j, i, 1, false);
                    id.DrawCross(Color.Lime, j, i, 1, false);
                    id.DrawPlus(Color.Lime, j, i, 1, false);
                    id.DrawCircle(Color.Lime, j, i, 8, true);
                    id.DrawSquare(Color.Lime, j, i, 8, true);
                    id.DrawCross(Color.Lime, j, i, 8, true);
                    id.DrawPlus(Color.Lime, j, i, 8, true);
                }
            };

            if (chkDrawingRepeatParallel.Checked)
            {
                Parallel.For(0, 100, iAction);
            }
            else
            {
                for (int i = 0; i < 100; i++)
                {
                    iAction(i);
                }
            }
        }