private void Form1_Load(object sender, EventArgs e) { KeyPreview = true; drawBox.MouseClick += (object Asender, MouseEventArgs Ae) => { var mousePosition = Ae.Location; if (pointButton.Checked) { Drawing.DrawPixel(mousePosition, CurrentColor); } if (lineButton.Checked) { Drawing.DrawPixel(mousePosition, CurrentColor); Points.Add(mousePosition); if (Points.Count > 1) { DrawLines(); } } else { Points.Clear(); } if (fillButton.Checked) { if (fourModeButton.Checked) { Drawing.FillFour(mousePosition, BgColor, CurrentColor); } if (eightModeButton.Checked) { Drawing.FillEight(mousePosition, BgColor, CurrentColor); } if (randomModeButton.Checked) { Drawing.FillRandom(mousePosition, BgColor); } } drawBox.Image = Drawing.Canvas; }; }
private void Form1_Load(object sender, EventArgs e) { KeyPreview = true; drawBox.MouseClick += (object Asender, MouseEventArgs Ae) => { var mousePosition = drawBox.PointToClient(MousePosition); Drawing.DrawPixel(mousePosition, Color.Red); drawBox.Image = Drawing.Canvas; if (Ae.Button == MouseButtons.Right) { Center = mousePosition; label1.Text = $"Center: {Center}"; } else { Clicks++; X.Add(mousePosition.X); Y.Add(mousePosition.Y); X_.Add(mousePosition.X); Y_.Add(mousePosition.Y); if (Clicks >= 2) { Logic(); } } }; }
private void Form1_Load(object sender, EventArgs e) { KeyPreview = true; drawBox.MouseClick += (object Asender, MouseEventArgs Ae) => { var mousePosition = drawBox.PointToClient(MousePosition); Drawing.DrawPixel(mousePosition, Color.Red); drawBox.Image = Drawing.Canvas; Clicks++; Points.Add(mousePosition); if (Clicks >= 2) { Logic(); } }; }
private void Form1_Load(object sender, EventArgs e) { KeyPreview = true; drawBox.MouseClick += (object Asender, MouseEventArgs Ae) => { var mousePosition = drawBox.PointToClient(MousePosition); Drawing.DrawPixel(mousePosition, Color.Red); drawBox.Image = Drawing.Canvas; Clicks++; Points.Add(mousePosition); Vertices.Add(mousePosition); if (Clicks >= 2) { Logic(); } if (Clicks % 4 == 0) { Clicks = 0; Points.Clear(); try { Drawing.Triagle(Vertices[0], Vertices[1], Vertices[2]); } catch (Exception error) { Console.WriteLine(error.Message); } Vertices.Clear(); drawBox.Image = Drawing.Canvas; } }; }