Exemplo n.º 1
0
 void dataGridView_CellFormatting(object sender, TreeDataGridViewCellFormattingEventArgs e)
 {
     if (e.RowIndexHierarchy.Count == 1 && e.ColumnIndex == databaseColumn.Index)
     {
         e.CellStyle.BackColor = File.Exists((string)e.Value) ? SystemColors.Window : Color.LightSalmon;
     }
     else if (e.RowIndexHierarchy.Count > 1)
     {
         // if the current analysis parameter is one of the differing paremeters (as stored in the original analysis name);
         // make the text red
         var analysisRow      = rows[e.RowIndexHierarchy[0]];
         var currentParameter = analysisRow.Analysis.parameters.ElementAt(e.RowIndexHierarchy[1]);
         if (analysisRow.OriginalAnalysisName.Contains(currentParameter.Key.Replace("Config: ", "") + "="))
         {
             e.CellStyle.ForeColor = Color.Red;
         }
     }
 }
Exemplo n.º 2
0
 void dataGridView_CellFormatting(object sender, TreeDataGridViewCellFormattingEventArgs e)
 {
     if (e.RowIndexHierarchy.Count == 1 && e.ColumnIndex == databaseColumn.Index)
         e.CellStyle.BackColor = File.Exists((string)e.Value) ? SystemColors.Window : Color.LightSalmon;
     else if (e.RowIndexHierarchy.Count > 1)
     {
         // if the current analysis parameter is one of the differing paremeters (as stored in the original analysis name);
         // make the text red
         var analysisRow = rows[e.RowIndexHierarchy[0]];
         var currentParameter = analysisRow.Analysis.parameters.ElementAt(e.RowIndexHierarchy[1]);
         if (analysisRow.OriginalAnalysisName.Contains(currentParameter.Key.Replace("Config: ", "") + "="))
             e.CellStyle.ForeColor = Color.Red;
     }
 }
Exemplo n.º 3
0
        private void treeDataGridView_CellFormatting (object sender, TreeDataGridViewCellFormattingEventArgs e)
        {
            var column = treeDataGridView.Columns[e.ColumnIndex];
            if (_columnSettings.ContainsKey(column) && _columnSettings[column].BackColor.HasValue)
                e.CellStyle.BackColor = _columnSettings[column].BackColor.Value;
            else
                e.CellStyle.BackColor = e.CellStyle.BackColor;

            if (e.RowIndexHierarchy.Count == 1 && e.RowIndexHierarchy[0] == -1)
                return;

            Row row = GetRowFromRowHierarchy(e.RowIndexHierarchy);

            switch (getRowFilterState(row))
            {
                case RowFilterState.Out:
                    e.CellStyle.ForeColor = filteredOutColor;
                    break;
                case RowFilterState.Partial:
                    e.CellStyle.ForeColor = filteredPartialColor;
                    break;
            }

            if (column is DataGridViewLinkColumn)
            {
                var cell = treeDataGridView[e.ColumnIndex, e.RowIndexHierarchy] as DataGridViewLinkCell;
                cell.LinkColor = cell.ActiveLinkColor = e.CellStyle.ForeColor;
            }
        }