Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int    n  = int.Parse(textBox1.Text);
            int    nn = n * n;
            double h  = double.Parse(textBox2.Text);
            double s  = double.Parse(textBox3.Text);
            double v  = double.Parse(textBox4.Text);
            int    w1 = this.Width / n;
            int    h1 = this.Height / n;

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    Color c = new Color();

                    c = Route.RandomColorHSV(h, s, v);
                    Brush b = new SolidBrush(c);

                    tabPage1.CreateGraphics().FillRectangle(b, i * w1, j * h1, w1, h1);
                }
            }

            //tabControl1.Hide();
        }
Beispiel #2
0
        protected virtual void OnButton2Clicked(object sender, System.EventArgs e)
        {
            int n = (int)entry1.Text;

            nn = n * n;
            double h = (double)entry2.Text;
            double s = (double)entry3.Text;
            double v = (double)entry4.Text;
            int    w = drawingarea2.WidthRequest / n;
            int    h = drawingarea2.HeightRequest / n;

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    Color c = new Color();

                    c = Route.RandomColorHSV(h, s, v);
                    drawingarea2.Draw(new Rectangle(i * w, j * h, w, h));
                }
            }

            notebook1.CurrentPage = 1;
        }