private void setListBoxPoints() { if (listBoxPoints.Items.Count > 0) { listBoxPoints.Items.Clear(); } listBoxPoints.Items.AddRange(ListPointDesc.ToArray()); SetEnabledBtnDeletePoint(); }
private void ClearListPoints_Click(object sender, EventArgs e) { if (ListPoints.Count > 0 && ListPointDesc.Count > 0) { ListPoints.Clear(); ListPointDesc.Clear(); setListBoxPoints(); } }
private void DeleteSelectPoint_Click(object sender, EventArgs e) { if (listBoxPoints.Items.Count > 0 && listBoxPoints.SelectedIndex > -1) { ListPoints.RemoveAt(listBoxPoints.SelectedIndex); ListPointDesc.RemoveAt(listBoxPoints.SelectedIndex); setListBoxPoints(); } else if (listBoxPoints.Items.Count > 0 && listBoxPoints.SelectedIndex == -1) { ListPoints.RemoveAt(0); ListPointDesc.RemoveAt(0); setListBoxPoints(); } }
private void AddPoint_Click(object sender, EventArgs e) { if (GetPointY.Length > 0 && GetPointX.Length > 0) { int x = Int32.Parse(GetPointX); GetPointX = ""; int y = Int32.Parse(GetPointY); GetPointY = ""; int[] point = { x, y }; ListPoints.Add(point); ListPointDesc.Add($"Вершина с координатой: {x}; {y}"); setListBoxPoints(); } }