Hi Deivaselvan,
Is there any workaround for this ?
|
public Form1()
{
InitializeComponent();
this.sfDataGrid.DrawCell += sfDataGrid_DrawCell;
this.sfDataGrid.CurrentCellBeginEdit += sfDataGrid_CurrentCellBeginEdit;
}
void sfDataGrid_CurrentCellBeginEdit(object sender, Syncfusion.WinForms.DataGrid.Events.CurrentCellBeginEditEventArgs e)
{
if (e.DataColumn.GridColumn.MappingName == "Quantity")
e.Cancel = true;
}
void sfDataGrid_DrawCell(object sender, Syncfusion.WinForms.DataGrid.Events.DrawCellEventArgs e)
{
if (e.Column.MappingName == "Quantity")
{
e.Handled = true;
Syncfusion.Windows.Forms.Tools.ProgressBarAdv progressBar = new Syncfusion.Windows.Forms.Tools.ProgressBarAdv();
progressBar.ProgressStyle = Syncfusion.Windows.Forms.Tools.ProgressBarStyles.Office2016Colorful;
progressBar.GradientStartColor = Color.White;
progressBar.GradientEndColor = Color.Green;
progressBar.Value = int.Parse(e.DisplayText);
var cellRect = this.sfDataGrid.TableControl.GetCellRectangle(e.RowIndex, e.ColumnIndex, false);
progressBar.Draw(e.Graphics, cellRect);
e.Graphics.DrawLine(new Pen(this.sfDataGrid.Style.CellStyle.Borders.Bottom.Color), cellRect.X, cellRect.Bottom, cellRect.X + cellRect.Width, cellRect.Bottom);
}
} |
|
this.sfDataGrid.Style.ProgressBarStyle.ForegroundStyle = GridProgressBarStyle.Gradient;
sfDataGrid.QueryProgressBarCellStyle += SfDataGrid_QueryProgressBarCellStyle;
private void SfDataGrid_QueryProgressBarCellStyle(object sender, QueryProgressBarCellStyleEventArgs e)
{
if (e.Column.MappingName == "SoftwareProficiency")
{
if (e.Value > 50)
{
e.Style.GradientForegroundStartColor = Color.Red;
e.Style.GradientForegroundEndColor = Color.Orange;
}
else
{
e.Style.GradientForegroundStartColor = Color.DarkGreen;
e.Style.GradientForegroundEndColor = Color.LightGreen;
}
}
} |