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 ParentWindow
- {
- public partial class Paint : Form
- {
- bool paint = false;
- SolidBrush color;
- public Paint()
- {
- InitializeComponent();
- }
- private void Paint_Load(object sender, EventArgs e)
- {
- }
- private void panel1_MouseUp(object sender, MouseEventArgs e)
- {
- paint = false;
- }
- private void panel1_MouseDown(object sender, MouseEventArgs e)
- {
- paint = true;
- }
- private void panel1_MouseMove(object sender, MouseEventArgs e)
- {
- if (paint)
- {
- color = new SolidBrush(Color.Black);
- Graphics g = panel1.CreateGraphics();
- g.FillEllipse(color, e.X, e.Y, 10, 10);
- g.Dispose();
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Graphics gl = panel1.CreateGraphics();
- gl.Clear(panel1.BackColor);
- }
- private void panel1_Paint(object sender, PaintEventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement