Articles in this section
Category / Section

How do can I get a blinker cell in a GridDataBoundGrid?

2 mins read

 

You can acheive this by providing the backcolor on demand in the PrepareViewStyleInfo event handler and changing this color alternatively in a timers tick event handler. Please refer the following code snippet:

C#

//Setting color on demand

private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)

{

if(e.RowIndex > 0 && e.ColIndex > 0)

{

if(e.RowIndex == this.row && e.ColIndex == this.col)

{

e.Style.BackColor = this.color;

}

}

}

//Invoke the Timer

private void timer1_Tick(object sender, System.EventArgs e)

{

this.color = (this.color == Color.White)

? Color.Red : Color.White;

this.gridDataBoundGrid1.InvalidateRange(GridRangeInfo.Cell(this.row, this.col));

}

VB

"Setting color on demand

Private Sub gridDataBoundGrid1_PrepareViewStyleInfo(sender As Object, e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) Handles gridDataBoundGrid1.PrepareViewStyleInfo

If e.RowIndex > 0 AndAlso e.ColIndex > 0 Then

If e.RowIndex = Me.row AndAlso e.ColIndex = Me.col Then

e.Style.BackColor = Me.color

End If

End If

End Sub "gridDataBoundGrid1_PrepareViewStyleInfo

"Invoke the Timer

Private Sub timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles timer1.Tick

If (Me.color.Equals(color.White)) Then

Me.color = color.Red

Else

Me.color = color.White

End If

Me.gridDataBoundGrid1.InvalidateRange(GridRangeInfo.Cell(Me.row, Me.col))

End Sub "timer1_Tick

Here is the link with both CS and VB samples: http://help.syncfusion.com/samples/KB/Grid.Windows/GDBG_Blink/

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied