private void dgrProperties_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 1 && e.RowIndex == 2)
     {
         FeaturesForm featuresForm  = new FeaturesForm();
         Point        pointToScreen = PointToScreen(dgrProperties.Location);
         int          x             = pointToScreen.X + dgrProperties.Columns[0].Width;
         int          y             = pointToScreen.Y + dgrProperties.ColumnHeadersHeight + dgrProperties.Rows[e.RowIndex].Height * (e.RowIndex + 1);
         featuresForm.Location = new Point(x, y);
         if (featuresForm.ShowDialog() == DialogResult.OK)
         {
             FeatureProperty feature = featuresForm.SelectedProperty;
             if (feature != null && selectedEnvVariable != null)
             {
                 dgrProperties[e.ColumnIndex, e.RowIndex].Value = feature.Name;
                 selectedEnvVariable.Feature = feature;
             }
         }
     }
     else if (e.ColumnIndex == 1 && e.RowIndex >= 0)
     {
         dgrProperties.BeginEdit(true);
         Type type = dgrProperties[e.ColumnIndex, e.RowIndex].GetType();
         if (type == typeof(DataGridViewComboBoxCell))
         {
             DataGridViewComboBoxEditingControl comboboxEdit = (DataGridViewComboBoxEditingControl)dgrProperties.EditingControl;
             comboboxEdit.DroppedDown = true;
         }
     }
 }
Esempio n. 2
0
        private void ShowFeatures(TreeNode selectedNode)
        {
            FeaturesForm featureForm = new FeaturesForm();

            if (featureForm.ShowDialog() == DialogResult.OK)
            {
                FeatureProperty selectedFeature = featureForm.SelectedProperty;
                ComponentNode   componentNode   = (ComponentNode)selectedNode.Tag;
                if (componentNode.Type == ComponentType.Folder || componentNode.Type == ComponentType.RootFolder)
                {
                    // recursively apply selected feature to all nodes under the selected node
                    foreach (TreeNode node in selectedNode.Nodes)
                    {
                        ApplyFeature(node, selectedFeature);
                    }
                }
                else
                {
                    componentNode.Property.Feature = selectedFeature;
                }
            }
        }