private void Form1_MouseMove(object sender, MouseEventArgs e)
{
xValueLabel.Text = e.X.ToString();
yValueLabel.Text = e.Y.ToString();
if (CanMove == true)
{
Pen pen = new Pen(col, 3);
Graphics g = this.CreateGraphics();
endpt.X = e.X;
endpt.Y = e.Y;
if (ComVar.drawType != ComVar.DrawTypes.line)
g.Clear(Color.White);
switch (ComVar.drawType)
{
case ComVar.DrawTypes.line:
g.DrawLine(pen, middlept, endpt);
break;
case ComVar.DrawTypes.rect:
min.X = Math.Min(startpt.X, middlept.X);
min.Y = Math.Min(startpt.Y, middlept.Y);
wide = Math.Abs(middlept.X - startpt.X);
high = Math.Abs(middlept.Y - startpt.Y);
g.DrawRectangle(pen, min.X, min.Y, wide, high);
break;
case ComVar.DrawTypes.ellipse:
g.DrawEllipse(pen, startpt.X, startpt.Y, middlept.X - startpt.X, middlept.Y - startpt.Y);
break;
}
middlept = endpt;
}
}