void sfDataGrid1_QueryCellStyle(object sender, Syncfusion.WinForms.DataGrid.Events.QueryCellStyleEventArgs e)
 {
     if (e.RowIndex == hoveredRowIndex)
     {
         //Set the back color for the hovered row cells.
         e.Style.BackColor = Color.Yellow;
     }
 }
        void sfDataGrid_QueryCellStyle(object sender, Syncfusion.WinForms.DataGrid.Events.QueryCellStyleEventArgs e)
        {
            var rowColumnIndex = new RowColumnIndex(e.RowIndex, e.ColumnIndex);

            if (colorDict.ContainsKey(rowColumnIndex))
            {
                e.Style.BackColor = colorDict[rowColumnIndex];
            }
        }
 private void SfDataGrid1_QueryCellStyle(object sender, Syncfusion.WinForms.DataGrid.Events.QueryCellStyleEventArgs e)
 {
     if (e.Column.MappingName == "Color")
     {
         var userColourString = e.DisplayText;
         int userColourNumeric = 0;
         int.TryParse(userColourString, out userColourNumeric);
         var colourToUse = userColourNumeric;
         e.Style.BackColor = ColorTranslator.FromWin32(colourToUse);
         if (e.DisplayText == "0")
             e.Style.TextColor = Color.White;
     }            
 }     
Exemple #4
0
        private void FirstLevelSourceDataGrid_QueryCellStyle(object sender, Syncfusion.WinForms.DataGrid.Events.QueryCellStyleEventArgs e)
        {
            if (e.Column == null)
            {
                return;
            }

            var   cellValue = e.DisplayText == null ? string.Empty : e.DisplayText.ToString();
            float value;

            if (e.Column.MappingName == "Discount")
            {
                double discount;
                if (double.TryParse(cellValue, out discount) && discount < 10)
                {
                    e.Style.BackColor = Color.Maroon;
                    e.Style.TextColor = Color.White;
                }
            }
            else if (e.Column.MappingName == "UnitPrice")
            {
                value = float.Parse(cellValue);
                if (value > 50)
                {
                    e.Style.BackColor = Color.Aquamarine;
                }
            }
            else if (e.Column.MappingName == "Quantity")
            {
                value = float.Parse(cellValue);
                if (value < 6)
                {
                    e.Style.BackColor = Color.OrangeRed;
                }
            }
        }
 private void fieldsDataGrid_QueryCellStyle(object sender, Syncfusion.WinForms.DataGrid.Events.QueryCellStyleEventArgs e)
 {
     e.Style.HorizontalAlignment = HorizontalAlignment.Center;
     e.Style.VerticalAlignment   = System.Windows.Forms.VisualStyles.VerticalAlignment.Center;
 }
Exemple #6
0
 private void environmentsGrid_QueryCellStyle(object sender, Syncfusion.WinForms.DataGrid.Events.QueryCellStyleEventArgs e)
 {
     e.Style.BackColor = ((Logic.Environment)e.DataRow.RowData).Color;
 }