Syncfusion.Grid.Windows
Example 


The Rectangle
The customPaintDelegate

UpdateWithCustomPaint Method

Allows you to perform a quick Invalidate / Update pair on the grid without executing any of the grids default paint code. Instead you can provide your own routine to update invalidated areas in the grid.
Syntax
'Declaration
 
Public Sub UpdateWithCustomPaint( _
   ByVal r As Rectangle, _
   ByVal customPaintDelegate As PaintEventHandler _
) 
'Usage
 
Dim instance As GridControlBase
Dim r As Rectangle
Dim customPaintDelegate As PaintEventHandler
 
instance.UpdateWithCustomPaint(r, customPaintDelegate)
public void UpdateWithCustomPaint( 
   Rectangle r,
   PaintEventHandler customPaintDelegate
)

Parameters

r
The Rectangle
customPaintDelegate
The customPaintDelegate
Example
The following example lets you draw a small portion of the grid bypassing the grids paint handler (and it trying to recalculating layout cells and other precautions it takes when handling the Paint method).

When compared to calling DrawClippedGrid this approach is a bit slower but it avoids flickering since it can take advantage of the WinForms own double-buffering mechanism.

In OnPaint the grid checks InUpdateWithCustomPaint and if it is true then the grids Paint method will only call the delegate and immediately return.

gridTableControl.UpdateWithCustomPaint(bounds, new PaintEventHandler(TableControl_CustomPaint));
            
void TableControl_CustomPaint(object sender, PaintEventArgs e)
{
    Rectangle clipBounds = Rectangle.Truncate(e.Graphics.ClipBounds);
    gridTableControl.DrawClippedGrid(e.Graphics, clipBounds, false);
}
AssemblyVersion

Syncfusion.Grid.Windows: 17.3460.0.14

See Also