예제 #1
0
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            int i, x1, y1, w, h;

            System.Drawing.Graphics   Desen;
            System.Drawing.SolidBrush Pens_g, Pens_w;
            System.Drawing.Pen        Creion_g;
            Desen    = this.CreateGraphics();
            Pens_g   = new System.Drawing.SolidBrush(System.Drawing.Color.LightGray);
            Pens_w   = new System.Drawing.SolidBrush(System.Drawing.Color.WhiteSmoke);
            Creion_g = new System.Drawing.Pen(System.Drawing.Color.Gray, 3);
            System.Random n = new System.Random();
            Desen.Clear(this.BackColor);
            i = 0;
            while (i <= 50)
            {
                x1 = n.Next(this.Width);
                y1 = n.Next(this.Height);
                w  = n.Next(75);
                h  = this.Height - y1;
                if (i % 2 == 0)
                {
                    Desen.DrawRectangle(Creion_g, x1, y1, w, h);
                    Desen.FillRectangle(Pens_g, x1 + 1, y1 + 1, w - 1, h - 1);
                }
                else
                {
                    Desen.DrawRectangle(Creion_g, x1, y1, w, h);
                    Desen.FillRectangle(Pens_w, x1 + 1, y1 + 1, w - 1, h - 1);
                }
                i++;
            }
        }
예제 #2
0
 private void Form1_Paint(object sender, PaintEventArgs e)
 {
     System.Drawing.Graphics Desen;
     Desen = this.CreateGraphics();
     System.Drawing.Pen Creion_albastru;
     Creion_albastru = new System.Drawing.Pen(System.Drawing.Color.Blue);
     System.Drawing.SolidBrush Pensula_roz;
     Pensula_roz = new System.Drawing.SolidBrush(System.Drawing.Color.Pink);
     Desen.FillRectangle(Pensula_roz, 100, 60, 300, 300);
     Desen.DrawRectangle(Creion_albastru, 105, 65, 290, 290);
     Desen.DrawEllipse(Creion_albastru, 105, 65, 290, 290);
     Desen.DrawEllipse(Creion_albastru, 145, 65, 200, 290);
     Desen.DrawLine(Creion_albastru, 250, 65, 250, 355);
     Desen.DrawLine(Creion_albastru, 105, 65, 395, 355);
     Desen.DrawLine(Creion_albastru, 105, 355, 395, 65);
     Desen.DrawLine(Creion_albastru, 105, 210, 395, 210);
 }
예제 #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     System.Drawing.Graphics Desen;
     Desen = this.CreateGraphics();
     System.Drawing.Pen        Creion_albastru;
     System.Drawing.SolidBrush Pensula_albastra;
     Pensula_albastra = new System.Drawing.SolidBrush(System.Drawing.Color.Blue);
     Creion_albastru  = new System.Drawing.Pen(System.Drawing.Color.Blue);
     if (this.radioButton1.Checked)
     {
         Desen.DrawLine(Creion_albastru, 150, 50, 350, 100);
     }
     if (this.radioButton2.Checked)
     {
         Desen.Clear(this.BackColor);
         Desen.DrawRectangle(Creion_albastru, 250, 50, 200, 100);
     }
     if (this.radioButton3.Checked)
     {
         Desen.Clear(this.BackColor);
         Desen.DrawEllipse(Creion_albastru, 250, 150, 105, 105);
     }
     if (this.radioButton4.Checked)
     {
         Desen.Clear(this.BackColor);
         Desen.DrawEllipse(Creion_albastru, 150, 50, 95, 200);
     }
     if (this.radioButton5.Checked)
     {
         Desen.Clear(this.BackColor);
         Desen.FillRectangle(Pensula_albastra, 250, 50, 200, 100);
     }
     if (this.radioButton6.Checked)
     {
         Desen.Clear(this.BackColor);
         Desen.FillEllipse(Pensula_albastra, 150, 50, 95, 200);
     }
 }