Description: When you pull the DataGridView scroll bar, it flashes and looks like you're redrawing it, and it doesn't feel good.
WORKAROUND: Use a dual caching mechanism to add a method to the scenario.
Code:
PublicStaticClassExtensionmethods
{
PublicStaticvoidDoubleBuffered (ThisDataGridView DGV,boolSetting
{
Type Dgvtype= DGV. GetType ();
propertyinfo pi =< Span style= "color: #000000;" > dgvtype.getproperty ( "doublebuffered " Bindingflags.instance | bindingflags.nonpublic);
pi. SetValue (Dgv, setting, null }
}
< Span style= "color: #0000ff;" >< Span style= "color: #000000;" >< Span style= "color: #000000;" > If DotNetBar control is used DATAGRIDVIEWX
< Span style= "color: #0000ff;" >< Span style= "color: #000000;" >< Span style= "color: #000000;" >public Static class doublebuffered
< Span style= "color: #000000;" >< Span style= "color: #0000ff;" >< Span style= "color: #000000;" >< /span>
< Span style= "color: #000000;" >< Span style= "color: #000000;" >< Span style= "color: #000000;" >public static void DoubleBuffered (Datagridviewx DGV, BOOL setting)
< Span style= "color: #000000;" >< Span style= "color: #0000ff;" >< Span style= "color: #000000;" >< /span>
< Span style= "color: #0000ff;" >< Span style= "color: #000000;" >< Span style= "color: #000000;" >type dgvtype = DGV. GetType ();
< Span style= "color: #0000ff;" >< Span style= "color: #000000;" >< Span style= "color: #0000ff;" >propertyinfo pi = Dgvtype.getproperty ("doublebuffered", bindingflags.instance| BindingFlags.NonPublic)
< Span style= "color: #0000ff;" >< Span style= "color: #000000;" >< Span style= "color: #000000;" >pi. SetValue (dgv,setting,null);
< Span style= "color: #000000;" >< Span style= "color: #0000ff;" >< Span style= "color: #000000;" >
< Span style= "color: #000000;" >< Span style= "color: #0000ff;" >< Span style= "color: #000000;" >
C#datagridview ways to prevent flicker