Comments (0)

Files changed (2)

File vsSolutionBuildEvent/UI/WForms/PropertiesFrm.Designer.cs Modified

View file
  • Ignore whitespace
  • Hide word diff
             this.textBoxFilter.Size = new System.Drawing.Size(276, 20);
             this.textBoxFilter.TabIndex = 0;
             this.textBoxFilter.TextChanged += new System.EventHandler(this.textBoxFilter_TextChanged);
+            this.textBoxFilter.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBoxFilter_KeyDown);
             this.textBoxFilter.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBoxFilter_KeyUp);
             // 
             // labelFiler
             this.textBoxFilterVal.Size = new System.Drawing.Size(281, 20);
             this.textBoxFilterVal.TabIndex = 6;
             this.textBoxFilterVal.TextChanged += new System.EventHandler(this.textBoxFilterVal_TextChanged);
+            this.textBoxFilterVal.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBoxFilterVal_KeyDown);
             this.textBoxFilterVal.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBoxFilterVal_KeyUp);
             // 
             // splitContainerFilters

File vsSolutionBuildEvent/UI/WForms/PropertiesFrm.cs Modified

View file
  • Ignore whitespace
  • Hide word diff
             }
         }
 
+        protected void keyDownToDGV(DataGridView grid, object sender, KeyEventArgs e)
+        {
+            if(grid == null || grid.CurrentCell == null) {
+                e.SuppressKeyPress = (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down);
+                return;
+            }
+
+            if(e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
+            {
+                int newpos          = grid.CurrentCell.RowIndex + (e.KeyCode == Keys.Up ? -1 : 1);
+                grid.CurrentCell    = grid[0, Math.Max(0, Math.Min(newpos, grid.Rows.Count - 1))];
+                e.SuppressKeyPress  = true;
+                return;
+            }
+        }
+
         /// <exception cref="MSBuildParserProjectNotFoundException">if not found the specific project</exception>
         private List<TMSBuildPropertyItem> _getProperties(string project)
         {
             return null;
         }
 
+        private void _cellColor(Color backColor, Color foreColor, DataGridViewRow row)
+        {
+            row.DefaultCellStyle.SelectionBackColor = backColor;
+            row.DefaultCellStyle.SelectionForeColor = foreColor;
+        }
+
         private void EnvironmentVariablesFrm_Load(object sender, EventArgs e)
         {
             _cacheProperties.Clear();
 
         private void dataGridViewVariables_CellClick(object sender, DataGridViewCellEventArgs e)
         {
-            dataGridViewVariables.Rows[e.RowIndex].DefaultCellStyle.SelectionBackColor = Color.FromArgb(225, 241, 253);
-            dataGridViewVariables.Rows[e.RowIndex].DefaultCellStyle.SelectionForeColor = Color.FromArgb(23, 36, 47);
+            if(e.RowIndex < 0) {
+                return;
+            }
+            _cellColor(Color.FromArgb(225, 241, 253), Color.FromArgb(23, 36, 47), dataGridViewVariables.Rows[e.RowIndex]);
         }
 
         private void dataGridViewVariables_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
         {
-            if(e.RowIndex >= 0) {
-                _pin.property(dataGridViewVariables[0, e.RowIndex].Value.ToString(), getSelectedProject());
+            if(e.RowIndex < 0) {
+                return;
             }
-
-            dataGridViewVariables.Rows[e.RowIndex].DefaultCellStyle.SelectionBackColor = Color.FromArgb(245, 242, 203);
-            dataGridViewVariables.Rows[e.RowIndex].DefaultCellStyle.SelectionForeColor = Color.FromArgb(23, 36, 47);
+            _pin.property(dataGridViewVariables[0, e.RowIndex].Value.ToString(), getSelectedProject());
+            _cellColor(Color.FromArgb(245, 242, 203), Color.FromArgb(23, 36, 47), dataGridViewVariables.Rows[e.RowIndex]);
         }
 
         private void menuItemExportList_Click(object sender, EventArgs e)
             textBoxFilterVal.BackColor  = textBoxFilter.BackColor;
             listRender();
         }
+
+        private void textBoxFilter_KeyDown(object sender, KeyEventArgs e)
+        {
+            keyDownToDGV(dataGridViewVariables, sender, e);
+        }
+
+        private void textBoxFilterVal_KeyDown(object sender, KeyEventArgs e)
+        {
+            keyDownToDGV(dataGridViewVariables, sender, e);
+        }
     }
 }