private void toolStripMenuItem2_Click(object sender, EventArgs e) { if (locked || !Loaded) { return; } if (Read == null) { return; } if (RegionDataGrid.CurrentCell == null && ZonesDataGrid.CurrentCell != null) { return; } try { int index = RegionDataGrid.CurrentCell.RowIndex; int zoneId = ZonesDataGrid.CurrentCell.RowIndex; if (zoneId == 0 || zoneId == Read.regions[index].Zones.Count - 1) { JMessageBox.Show(this, "Can't Delete first and last point!"); return; } Read.regions[index].Zones.RemoveAt(zoneId); ZonesDataGrid.RowCount = Read.regions[index].Zones.Count; ZonesDataGrid.Refresh(); listBox_items_SelectionChanged(null, null); ZonesDataGrid.ClearSelection(); int nRowIndex = ZonesDataGrid.Rows.Count - 1; int nColumnIndex = 0; ZonesDataGrid.Rows[nRowIndex].Selected = true; ZonesDataGrid.Rows[nRowIndex].Cells[nColumnIndex].Selected = true; } catch { } }
private void toolStripMenuItem1_Click(object sender, EventArgs e) { if (locked || !Loaded) { return; } if (Read == null) { return; } if (RegionDataGrid.CurrentCell == null && ZonesDataGrid.CurrentCell != null) { return; } try { int index = RegionDataGrid.CurrentCell.RowIndex; int zoneId = ZonesDataGrid.CurrentCell.RowIndex; Read.regions[index].Zones.Insert(1, new Vector3(Read.regions[index].Zones[zoneId].oX, Read.regions[index].Zones[zoneId].oY, Read.regions[index].Zones[zoneId].oZ)); ZonesDataGrid.RowCount = Read.regions[index].Zones.Count; ZonesDataGrid.Refresh(); listBox_items_SelectionChanged(null, null); ZonesDataGrid.ClearSelection(); int nRowIndex = 1; int nColumnIndex = 0; ZonesDataGrid.Rows[nRowIndex].Selected = true; ZonesDataGrid.Rows[nRowIndex].Cells[nColumnIndex].Selected = true; } catch { } }