コード例 #1
0
ファイル: LipSyncMapEditor.cs プロジェクト: nedbert/vixen
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            List <ElementNode> chosenNodes = new List <ElementNode>();


            int lastColumn = currentDataTable.Columns.Count - 1;

            if (e.RowIndex > -1)
            {
                if (e.ColumnIndex == lastColumn)
                {
                    LipSyncMapColorSelect colorDialog1 = new LipSyncMapColorSelect();

                    foreach (DataGridViewCell selCell in dataGridView1.SelectedCells)
                    {
                        if (selCell.ColumnIndex == lastColumn)
                        {
                            ElementNode theNode = FindElementNode((string)selCell.OwningRow.Cells[0].Value);
                            if (theNode != null)
                            {
                                chosenNodes.Add(theNode);
                            }
                        }
                    }

                    colorDialog1.ChosenNodes = chosenNodes;
                    colorDialog1.Color       = (Color)dataGridView1.SelectedCells[0].Value;

                    // Show the color dialog.
                    DialogResult result = colorDialog1.ShowDialog();

                    // See if user pressed ok.
                    if (result == DialogResult.OK)
                    {
                        currentDataTable.Columns[COLOR_COLUMN_NAME].ReadOnly = false;
                        foreach (DataGridViewCell selCell in dataGridView1.SelectedCells)
                        {
                            if (selCell.ColumnIndex == lastColumn)
                            {
                                selCell.Value = colorDialog1.Color;
                            }
                        }
                        DataGridViewCell cell = (DataGridViewCell)dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
                        cell.Value = colorDialog1.Color;
                        currentDataTable.Columns[COLOR_COLUMN_NAME].ReadOnly = true;
                    }
                }
            }
        }
コード例 #2
0
ファイル: LipSyncMapEditor.cs プロジェクト: stewmc/vixen
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            List<ElementNode> chosenNodes = new List<ElementNode>();


            int lastColumn = currentDataTable.Columns.Count - 1;
            if (e.RowIndex > -1)
            {
                if (e.ColumnIndex == lastColumn)
                {

                    LipSyncMapColorSelect colorDialog1 = new LipSyncMapColorSelect();

                    foreach (DataGridViewCell selCell in dataGridView1.SelectedCells)
                    {
                        if (selCell.ColumnIndex == lastColumn)
                        {
                            ElementNode theNode = FindElementNode((string)selCell.OwningRow.Cells[0].Value);
                            if (theNode != null)
                            {
                                chosenNodes.Add(theNode);
                            }
                        }
                    }

                    colorDialog1.ChosenNodes = chosenNodes;
                    colorDialog1.Color = (Color)dataGridView1.SelectedCells[0].Value;

                    // Show the color dialog.
                    DialogResult result = colorDialog1.ShowDialog();

                    // See if user pressed ok.
                    if (result == DialogResult.OK)
                    {
                        currentDataTable.Columns[COLOR_COLUMN_NAME].ReadOnly = false;
                        foreach (DataGridViewCell selCell in dataGridView1.SelectedCells)
                        {
                            if (selCell.ColumnIndex == lastColumn)
                            {
                                selCell.Value = colorDialog1.Color;
                            }
                        }
                        DataGridViewCell cell = (DataGridViewCell)dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
                        cell.Value = colorDialog1.Color;
                        currentDataTable.Columns[COLOR_COLUMN_NAME].ReadOnly = true;
                    }
                }
            }
        }