Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApp15
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Paint(object sender, PaintEventArgs e)
- {
- Pen pen = new Pen(Color.Red, 2);
- Graphics graphics = CreateGraphics();
- Random r = new Random();
- int color = r.Next(7);
- int color = 0;
- if (color < 3)
- {
- color = Color.Red;
- }
- for (int i = 0; i <100 ; i++)
- {
- graphics.Clear(Color.White);
- int x = r.Next(200);
- int y = r.Next(200);
- Quad(graphics, pen, x, y);
- System.Threading.Thread.Sleep(1000);
- }
- }
- private void Quad(Graphics graphics, Pen pen,int x=200,int y=200)
- {
- graphics.DrawRectangle(pen, x-10, y-10, x+10, y+10);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement