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 kolos_0_termin
- {
- public partial class Form1 : Form
- {
- List<Kulka> kulki = new List<Kulka>();
- Pen pioro = new Pen(Color.Black, 10);
- Pen first = new Pen(Color.Red, 10);
- public bool hold = false;
- public Form1()
- {
- InitializeComponent();
- }
- private void panel1_MouseMove(object sender, MouseEventArgs e)
- {
- Kulka nowa = new Kulka(e.X, e.Y);
- kulki.Add(nowa);
- if (kulki.Count >= 20 && hold == false)
- {
- kulki.RemoveAt(0);
- panel1.Refresh();
- }
- panel1.Refresh();
- }
- class Kulka
- {
- public int kx;
- public int ky;
- public Kulka(int x, int y)
- {
- kx = x;
- ky = y;
- }
- }
- private void panel1_Paint(object sender, PaintEventArgs e)
- {
- Graphics g = e.Graphics;
- g.DrawEllipse(first, kulki[0].kx, kulki[0].ky, 5, 5);
- for (int i = 1; i < kulki.Count; i++)
- {
- g.DrawEllipse(pioro, kulki[i].kx,kulki[i].ky,5, 5);
- }
- }
- private void panel1_MouseDown(object sender, MouseEventArgs e)
- {
- hold = true;
- }
- private void panel1_MouseUp(object sender, MouseEventArgs e)
- {
- hold = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement