Enables value editing via editors created over cells

Namespace: Dapfor.Net.Editors
Assembly: Dapfor.Net (in Dapfor.Net.dll) Version: 2.10.3.24917 (2.10.3.24917)

Syntax

C#
public interface IGridEditorService : IWindowsFormsEditorService
Visual Basic
Public Interface IGridEditorService
	Inherits IWindowsFormsEditorService
Visual C++
public interface class IGridEditorService : IWindowsFormsEditorService
F#
type IGridEditorService =  
    interface
        interface IWindowsFormsEditorService
    end

Examples

Demonstrates how to customize the drawing in editing cell
 Copy imageCopy
public class CheckBoxEditor : UITypeEditorEx
{
    public override bool GetPaintCellSupported()
    {
            return true;
    }
    public override void PaintCell(PaintCellEventArgs e)
    {
        //Prevent from text drawing
        e.Parts &= e.Parts ^ PaintPart.Text;

        //Default drawing
        base.PaintCell(e);

        //Dimensions to draw the check box
        Rectangle bounds = e.Cell.VirtualBounds;
        int len = bounds.Height;
        bounds.X += (bounds.Width - len) / 2;
        bounds.Width = len;

        //The cell is checked
        if (Equals(true, e.Cell.Value))
        {
            ControlPaint.DrawCheckBox(e.Graphics, bounds, ButtonState.Checked | ButtonState.Flat);
        }
        //The cell is not checked
        else if (Equals(false, e.Cell.Value))
        {
            ControlPaint.DrawCheckBox(e.Graphics, bounds, ButtonState.Normal | ButtonState.Flat);
        }
        //There is no value in cell
        else
        {
            ControlPaint.DrawCheckBox(e.Graphics, bounds, ButtonState.Normal | ButtonState.Inactive | ButtonState.Flat);
        }
    }

    public override void EditCell(IGridEditorService service, Cell cell)
    {
        //Updates the value
        object value = cell.Value;
        cell.Value = !Equals(true, value);
    }

    public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
    {
        return UITypeEditorEditStyle.None;
    }
}

See Also