/// <summary> /// mode:0 default, mode:1 for main lines, mode:2 for over orijin, mode:3 orijin max ways /// </summary> private void draw_line(Vector2 start_pos, Vector2 end_pos, float width = 5, int modes = 0, int line_int = 25) { Graphics g = this.CreateGraphics(); Color current_color = Color.Gray; if (line_int != 25) { try { float change_rate = float.Parse(one_line.Text) / 25; start_pos.x = start_pos.x / change_rate; start_pos.y = start_pos.y / change_rate; end_pos.x = end_pos.x / change_rate; end_pos.y = end_pos.y / change_rate; } catch { MessageBox.Show("Please Check The 1 Line Length Setting/Lütfen 1 Çizginin Uzunluğu Ayarını Gözden Geçirin", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (modes == 1) { current_color = Color.Gray; } else if (modes == 2)//user draw { if (!String.IsNullOrEmpty(vectorcolor.Text)) { current_color = Color.FromName(vectorcolor.Text.Remove(vectorcolor.Text.IndexOf('/'))); } else { MessageBox.Show("Please choose a color for vector/Lütfen vektör için bir renk seç", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } start_pos.y = -start_pos.y; end_pos.y = -end_pos.y; start_pos.x += 250; start_pos.y += 250; end_pos.x += 250; end_pos.y += 250; string start_def = null; string end_def = null; if (isdefstart.Checked) { Vector2 round = vector_range <Vector2>(new Vector2(start_pos.x, start_pos.y)); g.DrawString(String.Format(startdefine.Text, round.x, round.y), new Font("Arial", 10), new SolidBrush(Color.Aqua), start_pos.x - 0.4f, start_pos.y - 0.4f); start_def = startdefine.Text; } if (isdefend.Checked) { Vector2 round = vector_range <Vector2>(new Vector2(end_pos.x, end_pos.y)); g.DrawString(String.Format(enddefine.Text, round.x, round.y), new Font("Arial", 10), new SolidBrush(Color.Aqua), end_pos.x - 0.4f, end_pos.y - 0.4f); end_def = enddefine.Text; } user_data.one_line_eq = one_line_rate; user_data.user_vectors.Add(new User_Drawn_Vectors(new Vector2(float.Parse(startposx.Text), float.Parse(startposy.Text)), new Vector2(float.Parse(endposx.Text), float.Parse(endposy.Text)), vectorcolor.Text, start_def, end_def)); editings++; } else if (modes == 3) { start_pos.y = -start_pos.y; end_pos.y = -end_pos.y; start_pos.x += 250; start_pos.y += 250; end_pos.x += 250; end_pos.y += 250; current_color = Color.WhiteSmoke; } g.DrawLine(new Pen(current_color, width), start_pos.x + 50, start_pos.y + 30, end_pos.x + 50, end_pos.y + 30); //printing the poses draw_line_rate(); }
public User_Drawn_Marks(Vector2 pos, string mark_color, float mark_width) { this.mark_width = mark_width; this.mark_color = mark_color; this.pos = pos; }
private void mouse_down(object sender, MouseEventArgs e) { Vector2 fixed_positions = new Vector2(777, 777); Vector2 mouse_cursor_pos = new Vector2(((System.Windows.Forms.Cursor.Position.X - this.Location.X) - 58), (System.Windows.Forms.Cursor.Position.Y - this.Location.Y) - 60); if (mouse_cursor_pos.x <= 500 && mouse_cursor_pos.x >= 0 && mouse_cursor_pos.y <= 500 && mouse_cursor_pos.y >= 0) { if (!is_pencil_draw.Checked) { if (pointers[0].x == 777) { if (set_pos_corner.Checked) { #region getting the positions for (int j = 0; j < 525; j += 25) { //dont care pos is greater than 0 or less than 0 for now if (mouse_cursor_pos.x <= j - 10 || mouse_cursor_pos.x <= j + 10) { fixed_positions.x = j; break; } } for (int j = 0; j < 550; j += 25) { //dont care pos is greater than 0 or less than 0 for now if (mouse_cursor_pos.y <= j - 10 || mouse_cursor_pos.y <= j + 10) { fixed_positions.y = j; break; } } fixed_positions = vector_range <Vector2>(fixed_positions); #endregion } else if (!set_pos_corner.Checked) { fixed_positions = vector_range <Vector2>(mouse_cursor_pos); } pointers[0] = fixed_positions; startposx.Text = fixed_positions.x.ToString(); startposy.Text = fixed_positions.y.ToString(); } else if (pointers[1].x == 777) { if (set_pos_corner.Checked) { #region getting the positions for (int j = 0; j < 525; j += 25) { //dont care pos is greater than 0 or less than 0 for now if (mouse_cursor_pos.x <= j - 10 || mouse_cursor_pos.x <= j + 10) { fixed_positions.x = j; break; } } for (int j = 0; j < 550; j += 25) { //dont care pos is greater than 0 or less than 0 for now if (mouse_cursor_pos.y <= j - 10 || mouse_cursor_pos.y <= j + 10) { fixed_positions.y = j; break; } } fixed_positions = vector_range <Vector2>(fixed_positions); #endregion } else if (!set_pos_corner.Checked) { fixed_positions = vector_range <Vector2>(mouse_cursor_pos); } pointers[1] = fixed_positions; endposx.Text = fixed_positions.x.ToString(); endposy.Text = fixed_positions.y.ToString(); //drawing it pointers[0] = new Vector2(777, 777); pointers[1] = new Vector2(777, 777); user_draw_line_button("false"); } } else if (is_pencil_draw.Checked) { } //dont need for now } }