private void SmallLineRotation() { ObjectDrawer = new ObjectDrawer(); var smallLinePointCoordinates = ObjectDrawer.Rotation(_x3, _y3, _x2, _y2, 10); _x3 = smallLinePointCoordinates.Item1; _y3 = smallLinePointCoordinates.Item2; ObjectDrawer.DrawLine(Graphics, Color.Black, _x2, _y2, _x3, _y3); }
private void TimerForRotation_Tick(object sender, EventArgs e) { ObjectDrawer = new ObjectDrawer(); Graphics.FillRectangle(new SolidBrush(Color.Gray), 0, 0, pictureBox.Width, pictureBox.Height); var firstPointCoordinates = ObjectDrawer.Rotation(_x4, _y4, pictureBox.Width / 2, pictureBox.Height / 2, 15); var secondPointCoordinates = ObjectDrawer.Rotation(_x2, _y2, pictureBox.Width / 2, pictureBox.Height / 2, 15); _x4 = firstPointCoordinates.Item1; _y4 = firstPointCoordinates.Item2; _x2 = secondPointCoordinates.Item1; _y2 = secondPointCoordinates.Item2; ObjectDrawer.DrawLine(Graphics, Color.Black, _x4, _y4, _x2, _y2); SmallLineRotation(); ObjectDrawer.DrawLine(Graphics, Color.Black, pictureBox.Width / 2, pictureBox.Height / 2, _x2, _y2); }
private void LineButton_Click(object sender, EventArgs e) { ObjectDrawer = new ObjectDrawer(); var random = new Random(); _x1 = random.Next(pictureBox.Width); _x2 = random.Next(pictureBox.Width); _y1 = random.Next(pictureBox.Height); _y2 = random.Next(pictureBox.Height); ObjectDrawer.DrawLine(pictureBox.CreateGraphics(), Color.Black, _x1, _y1, _x2, _y2); }
private void LineRotationButton_Click(object sender, EventArgs e) { ObjectDrawer = new ObjectDrawer(); Graphics = Graphics.FromHwnd(pictureBox.Handle); _x2 = pictureBox.Width / 2; _y2 = (pictureBox.Height / 2) - 100; _x4 = pictureBox.Width / 2; _y4 = (pictureBox.Height / 2) + 100; //ObjectDrawer.DrawLine(Graphics, Color.Black, _x4, _y4, _x2, _y2); ObjectDrawer.DrawLine(Graphics, Color.Black, _x2, _y2, _x3, _y3); ObjectDrawer.DrawLine(Graphics, Color.Black, pictureBox.Width / 2, pictureBox.Height / 2, _x2, _y2); _x3 = _x2; _y3 = _y2 - 50; Graphics.FillRectangle(new SolidBrush(Color.Gray), 0, 0, pictureBox.Width, pictureBox.Height); timerForRotation.Enabled = true; }