Extension of UITypeEditor that enables painting in cells and creating any controls over cells.
Namespace: Dapfor.Net.EditorsAssembly: Dapfor.Net (in Dapfor.Net.dll) Version: 2.10.3.24917 (2.10.3.24917)
Syntax
C# |
---|
public class UITypeEditorEx : UITypeEditor |
Visual Basic |
---|
Public Class UITypeEditorEx Inherits UITypeEditor |
Visual C++ |
---|
public ref class UITypeEditorEx : public UITypeEditor |
F# |
---|
type UITypeEditorEx = class inherit UITypeEditor end |
Remarks
The following example demonstrates how to customize cell drawing and editing
Copy | |
---|---|
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; } } |
Inheritance Hierarchy
System..::..Object
System.Drawing.Design..::..UITypeEditor
Dapfor.Net.Editors..::..UITypeEditorEx
Dapfor.Net.Editors..::..AppearanceEditor
Dapfor.Net.Editors..::..CheckBoxEditor
Dapfor.Net.Editors..::..ConvertibleValueEditor
Dapfor.Net.Editors..::..DropDownEditor
Dapfor.Net.Editors..::..TrackBarEditor
Dapfor.Net.Editors..::..UpDownNumericEditor
System.Drawing.Design..::..UITypeEditor
Dapfor.Net.Editors..::..UITypeEditorEx
Dapfor.Net.Editors..::..AppearanceEditor
Dapfor.Net.Editors..::..CheckBoxEditor
Dapfor.Net.Editors..::..ConvertibleValueEditor
Dapfor.Net.Editors..::..DropDownEditor
Dapfor.Net.Editors..::..TrackBarEditor
Dapfor.Net.Editors..::..UpDownNumericEditor