Provides various useful functions for painting operations

Namespace: Dapfor.Net.Ui
Assembly: Dapfor.Net (in Dapfor.Net.dll) Version: (


public static class PaintHelper
Visual Basic
Public NotInheritable Class PaintHelper
Visual C++
public ref class PaintHelper abstract sealed
type PaintHelper =  class end


 Copy imageCopy
public void CellCustomDraw(Grid grid)
    //Demonstrates, how to custom draw in cell. 
    //The delegate is called while the cell's painting
    grid.PaintCell += delegate(object sender, PaintCellEventArgs e)
        //Draw a button in the cell's bounds. 
        Color startColor = Color.LightGray;
        Color endColor = Color.LightSlateGray;

        //Take into account, that the row can be selected.
        if (e.Cell.Row != null && e.Cell.Row.Selected)
            startColor = PaintHelper.AlphaBlend(startColor, grid.Selection.Color);
            endColor = PaintHelper.AlphaBlend(endColor, grid.Selection.Color);

        //Draw the background
        Appearance appearance = new Appearance(SystemColors.GrayText, startColor, true, endColor, GradientDirection.Vertical);
        e.Render.DrawCaption(appearance, ElementState.Normal, e.Cell.VirtualBounds, BorderSide.All, e.Graphics);

        //Prevent from background erasing
        e.Parts &= e.Parts ^ (PaintPart.Background | PaintPart.Borders);

        //Set a new text color
        e.Appearance.ForeColor = Color.Yellow;

        //Do default painting without the text drawing

Inheritance Hierarchy


See Also