コード例 #1
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            Int32 selectedRowCount = dataGridView1.Rows.GetRowCount(DataGridViewElementStates.Selected);

            if (selectedRowCount > 0 && Nodes_Added < NumberOfNodes)
            {
                if (selectedRowCount > 1)
                {
                    MessageBox.Show("Please select one row at a time.");
                }
                else
                {
                    int selectedRowIndex = dataGridView1.SelectedRows[0].Index;
                    if (!CurrentEtopolNodes.Contains(new NodesInformation(MainInterface.Nodes[selectedRowIndex].X, MainInterface.Nodes[selectedRowIndex].Y, MainInterface.Nodes[selectedRowIndex].Z)))
                    {
                        CurrentEtopolNodes.Add(new NodesInformation(MainInterface.Nodes[selectedRowIndex].X, MainInterface.Nodes[selectedRowIndex].Y, MainInterface.Nodes[selectedRowIndex].Z));
                        MainInterface.Etopol.Add(selectedRowIndex);
                        Nodes_Added += 1;
                        if (Nodes_Added == NumberOfNodes)
                        {
                            ElementMaterialSelection addElementMaterial = new ElementMaterialSelection();
                            addElementMaterial.ShowDialog();
                            Nodes_Added = 0;
                            CurrentEtopolNodes.Clear();
                        }
                        dataGridView2.DataSource = CurrentEtopolNodes.Select(vector => new { X = vector.X, Y = vector.Y, Z = vector.Z }).ToList();
                    }
                }
            }
        }
コード例 #2
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            Int32 selectedRowCount = dataGridView1.Rows.GetRowCount(DataGridViewElementStates.Selected);

            if (selectedRowCount > 0 && Nodes_Added < NumberOfNodes)
            {
                if (selectedRowCount > 1)
                {
                    MessageBox.Show("Please select one row at a time.");
                }
                else
                {
                    MainInterface.Etopol.Add(dataGridView1.SelectedRows[0].Index);
                    Nodes_Added += 1;
                    if (Nodes_Added == NumberOfNodes)
                    {
                        ElementMaterialSelection addElementMaterial = new ElementMaterialSelection();
                        addElementMaterial.ShowDialog();
                        Nodes_Added = 0;
                    }
                }
            }
        }