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.Drawing.Drawing2D;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using DrawingClassLib;
- namespace DrawingApp
- {
- public partial class Form1 : Form
- {
- protected bool Draw;
- public Form1()
- {
- Draw = false;
- InitializeComponent();
- }
- private void PictureBox_Paint(object sender, PaintEventArgs e)
- {
- if (Draw)
- {
- Graphics graph = PictureBox.CreateGraphics();
- Shape[] shape = new Shape[20];
- for (int i = 0; i < 4; i++)
- {
- shape[i] = new DrawingClassLib.Point();
- System.Threading.Thread.Sleep(20);
- }
- for (int i = 4; i < 8; i++)
- {
- shape[i] = new Circle();
- System.Threading.Thread.Sleep(20);
- }
- for (int i = 8; i < 12; i++)
- {
- shape[i] = new Ellipse();
- System.Threading.Thread.Sleep(10);
- }
- for (int i = 12; i < 16; i++)
- {
- shape[i] = new Segment();
- System.Threading.Thread.Sleep(10);
- }
- for (int i = 16; i < shape.Length; i++)
- {
- shape[i] = new DrawingClassLib.Rectangle();
- System.Threading.Thread.Sleep(10);
- }
- for (int i = 0; i < shape.Length; i++)
- {
- shape[i].Draw(graph);
- }
- }
- }
- private void drawShape_Click(object sender, EventArgs e)
- {
- Draw = true;
- Refresh();
- }
- private void clearButton_Click(object sender, EventArgs e)
- {
- Refresh();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment