using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace mauseTakip { public partial class Form1 : Form { bool ciz; int baslaX, baslaY; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.BackColor = Color.Orchid; } private void Form1_MouseDown(object sender, MouseEventArgs e) { ciz = true; baslaX = e.X; baslaY = e.Y; } private void Form1_MouseMove(object sender, MouseEventArgs e) { Graphics g = this.CreateGraphics(); Pen p = new Pen(Color.PowderBlue, 2); Point point1 = new Point(baslaX, baslaY); Point point2 = new Point(e.X, e.Y); if (ciz == true) { g.DrawLine(p, point1, point2); baslaX = e.X; baslaY = e.Y; } } private void Form1_MouseUp(object sender, MouseEventArgs e) { ciz = false; } } }
Dosyayı İndir