Class GridCellButton
Defines a cell button element to be used with a cell renderer. A cell renderer can have several cell button elements. Examples are numeric up and down buttons, combo box buttons, etc..
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public class GridCellButton : NonFinalizeDisposable, IDisposable
Remarks
The cell button is XP Themes enabled. It will be drawn themed if ThemesEnabled is true.
Constructors
GridCellButton(GridCellRendererBase)
Initializes a new GridCellButton and associates it with a GridCellRendererBase.
Declaration
public GridCellButton(GridCellRendererBase owner)
Parameters
Type | Name | Description |
---|---|---|
GridCellRendererBase | owner | The GridCellRendererBase that manages the GridCellButton. |
Properties
Bounds
Gets or sets the coordinates of the cell button element in grid client area coordinates.
Declaration
public virtual Rectangle Bounds { get; set; }
Property Value
Type |
---|
System.Drawing.Rectangle |
FireClickOnMouseUp
Gets or sets a value indicating whether button should fire a Clicked event when user clicks on button.
Declaration
public bool FireClickOnMouseUp { get; set; }
Property Value
Type |
---|
System.Boolean |
Grid
Gets a reference to the parent grid.
Declaration
protected GridControlBase Grid { get; }
Property Value
Type |
---|
GridControlBase |
MouseDownInfo
Gets the information of Saved HitTest.
Declaration
protected GridCellHitTestInfo MouseDownInfo { get; }
Property Value
Type |
---|
GridCellHitTestInfo |
Owner
Gets a reference to the GridCellRendererBase.
Declaration
public GridCellRendererBase Owner { get; }
Property Value
Type |
---|
GridCellRendererBase |
Text
Gets or sets the text that has to be displayed inside cell button element.
Declaration
public virtual string Text { get; set; }
Property Value
Type |
---|
System.String |
Methods
CancelMode(GridCellHitTestInfo)
Occurs when the current mouse operation is canceled.
Declaration
public virtual void CancelMode(GridCellHitTestInfo ht)
Parameters
Type | Name | Description |
---|---|---|
GridCellHitTestInfo | ht | The GridCellHitTestInfo with saved hit-test information about the mouse event. |
Dispose(Boolean)
Disposes the unmanaged resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Overrides
Draw(Graphics, Int32, Int32, Boolean, GridStyleInfo)
Draws the cell button element at the specified row and column index.
Declaration
public virtual void Draw(Graphics g, int rowIndex, int colIndex, bool bActive, GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The System.Drawing.Graphics context of the canvas. |
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
System.Boolean | bActive | True if this is the active current cell; False otherwise. |
GridStyleInfo | style | The GridStyleInfo object that holds cell information. |
DrawButton(Graphics, Rectangle, ButtonState, GridStyleInfo)
Draws a button using System.Windows.Forms.ControlPaint.DrawButton(System.Drawing.Graphics,System.Drawing.Rectangle,System.Windows.Forms.ButtonState) or if XP Themes are enabled, button will be drawn themed.
Declaration
public virtual void DrawButton(Graphics g, Rectangle rect, ButtonState buttonState, GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The System.Drawing.Graphics context of the canvas. |
System.Drawing.Rectangle | rect | The System.Drawing.Rectangle with the bounds. |
System.Windows.Forms.ButtonState | buttonState | A System.Windows.Forms.ButtonState that specifies the current state. |
GridStyleInfo | style | The style information for the cell. |
DrawMetroButtonStyle(Graphics, Rectangle, ButtonState, String, Boolean)
Draws the PushButton for Metro skin
Declaration
public void DrawMetroButtonStyle(Graphics g, Rectangle rect, ButtonState state, string value, bool isWhite)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | A System.Drawing.Graphics object. |
System.Drawing.Rectangle | rect | A System.Drawing.Rectangle object that represents the drawing area. |
System.Windows.Forms.ButtonState | state | The current state of the button. |
System.String | value | button value |
System.Boolean | isWhite | bool value |
GetCursor(GridCellHitTestInfo)
Return the cursor that you want to display.
Declaration
public virtual Cursor GetCursor(GridCellHitTestInfo ht)
Parameters
Type | Name | Description |
---|---|---|
GridCellHitTestInfo | ht | The GridCellHitTestInfo with saved hit-test information about the mouse event. |
Returns
Type | Description |
---|---|
System.Windows.Forms.Cursor | The System.Windows.Forms.Cursor to be displayed. |
HitTest(Int32, Int32, MouseEventArgs, IMouseController)
Tests if the mouse is over the button and if the button wants to handle any subsequent mouse event.
Declaration
public virtual int HitTest(int rowIndex, int colIndex, MouseEventArgs e, IMouseController controller)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
System.Windows.Forms.MouseEventArgs | e | The System.Windows.Forms.MouseEventArgs with data for the current mouse event. |
IMouseController | controller | A IMouseController that has indicated to handle the mouse event. |
Returns
Type | Description |
---|---|
System.Int32 | A non-zero value if the button can and wants to handle the mouse event; 0 if the mouse event is unrelated for this button. |
IsHovering(Int32, Int32)
Determines whether the mouse is currently hovering over the button at the specified row and column.
Declaration
public bool IsHovering(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
Returns
Type | Description |
---|---|
System.Boolean | True if mouse is over the button; False otherwise. |
IsMouseDown(Int32, Int32)
Determines whether the mouse is currently pressed at the specified row and column.
Declaration
public bool IsMouseDown(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
Returns
Type | Description |
---|---|
System.Boolean | True if mouse is pressed over the button; False otherwise. |
IsPushed(Int32, Int32)
Determines whether the button is marked as pushed at the specified row and column.
Declaration
public bool IsPushed(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
Returns
Type | Description |
---|---|
System.Boolean | True if the button is marked as pushed; False otherwise. |
MouseDown(MouseEventArgs, GridCellHitTestInfo)
This is called from GridCellRendererBase when HitTest(Int32, Int32, MouseEventArgs, IMouseController) has indicated it wants to receive mouse events and the user has pressed the mouse button.
Declaration
public virtual void MouseDown(MouseEventArgs e, GridCellHitTestInfo ht)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.MouseEventArgs | e | A System.Windows.Forms.MouseEventArgs with data about the mouse event. |
GridCellHitTestInfo | ht | The GridCellHitTestInfo with saved hit-test information about the mouse event. |
Remarks
Once MouseDown has been called you are guaranteed to receive a MouseUp or CancelModel call.
MouseHover(MouseEventArgs, GridCellHitTestInfo)
Occurs when the mouse is hovering over the button (and HitTest indicated it wants to handle the mouse event).
Declaration
public virtual void MouseHover(MouseEventArgs e, GridCellHitTestInfo ht)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.MouseEventArgs | e | A System.Windows.Forms.MouseEventArgs with data about the mouse event. |
GridCellHitTestInfo | ht | The GridCellHitTestInfo with saved hit-test information about the mouse event. |
Remarks
MouseHoverEnter(GridCellHitTestInfo) is called once before a series of MouseHover(MouseEventArgs, GridCellHitTestInfo) calls. MouseHoverLeave(EventArgs, GridCellHitTestInfo) is called when the mouse leaves the button or if the mouse button is pressed.
MouseHoverEnter(GridCellHitTestInfo)
Occurs when the mouse is hovering over the button (and HitTest indicated it wants to handle the mouse event).
Declaration
public virtual void MouseHoverEnter(GridCellHitTestInfo ht)
Parameters
Type | Name | Description |
---|---|---|
GridCellHitTestInfo | ht | The GridCellHitTestInfo with saved hit-test information about the mouse event. |
Remarks
MouseHoverEnter(GridCellHitTestInfo) is called once before a series of MouseHover(MouseEventArgs, GridCellHitTestInfo) calls. MouseHoverLeave(EventArgs, GridCellHitTestInfo) is called when the mouse leaves the button or if the mouse button is pressed.
MouseHoverLeave(EventArgs, GridCellHitTestInfo)
Occurs when the mouse has left hovering over the button (and HitTest indicated it wants to handle the mouse event).
Declaration
public virtual void MouseHoverLeave(EventArgs e, GridCellHitTestInfo ht)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | A System.EventArgs with data about the mouse event (can also be System.Windows.Forms.MouseEventArgs). |
GridCellHitTestInfo | ht | The GridCellHitTestInfo with saved hit-test information about the mouse event. |
Remarks
MouseHoverEnter(GridCellHitTestInfo) is called once before a series of MouseHover(MouseEventArgs, GridCellHitTestInfo) calls. MouseHoverLeave(EventArgs, GridCellHitTestInfo) is called when the mouse leaves the button or if the mouse button is pressed.
MouseMove(MouseEventArgs, GridCellHitTestInfo)
This is called from GridCellRendererBase when HitTest(Int32, Int32, MouseEventArgs, IMouseController) has indicated it wants to receive mouse events and the user has pressed the mouse button and is moving the mouse.
Declaration
public virtual void MouseMove(MouseEventArgs e, GridCellHitTestInfo ht)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.MouseEventArgs | e | A System.Windows.Forms.MouseEventArgs with data about the mouse event. |
GridCellHitTestInfo | ht | The GridCellHitTestInfo with saved hit-test information about the mouse event. |
Remarks
Once MouseDown has been called, you are guaranteed to receive a MouseUp or CancelModel call.
MouseUp(MouseEventArgs, GridCellHitTestInfo)
This is called from GridCellRendererBase when HitTest(Int32, Int32, MouseEventArgs, IMouseController) has indicated it wants to receive mouse events and the user has released the mouse button.
Declaration
public virtual void MouseUp(MouseEventArgs e, GridCellHitTestInfo ht)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.MouseEventArgs | e | A System.Windows.Forms.MouseEventArgs with data about the mouse event. |
GridCellHitTestInfo | ht | The GridCellHitTestInfo with saved hit-test information about the mouse event. |
Remarks
Once MouseDown has been called you are guaranteed to receive a MouseUp or CancelModel call.
OnClicked(GridCellEventArgs)
Raises the Clicked event.
Declaration
protected virtual void OnClicked(GridCellEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
GridCellEventArgs | e | A GridCellEventArgs with event data. |
OnHoveringChanged(GridCellEventArgs)
Raises the HoveringChanged event.
Declaration
protected virtual void OnHoveringChanged(GridCellEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
GridCellEventArgs | e | A GridCellEventArgs with event data. |
OnMouseDownChanged(GridCellEventArgs)
Raises the MouseDownChanged event.
Declaration
protected virtual void OnMouseDownChanged(GridCellEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
GridCellEventArgs | e | A GridCellEventArgs with event data. |
OnPushedChanged(GridCellEventArgs)
Raises the PushedChanged event.
Declaration
protected virtual void OnPushedChanged(GridCellEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
GridCellEventArgs | e | A GridCellEventArgs with event data. |
SetHovering(GridCellHitTestInfo, Boolean)
Saves current hovering state.
Declaration
public void SetHovering(GridCellHitTestInfo ht, bool value)
Parameters
Type | Name | Description |
---|---|---|
GridCellHitTestInfo | ht | The GridCellHitTestInfo with row and column index. |
System.Boolean | value | True to set hovering; False to reset hovering. |
SetMouseDown(GridCellHitTestInfo, Boolean)
Saves current MouseDown state.
Declaration
public void SetMouseDown(GridCellHitTestInfo ht, bool value)
Parameters
Type | Name | Description |
---|---|---|
GridCellHitTestInfo | ht | The GridCellHitTestInfo with row and column index. |
System.Boolean | value | True to set mouse down; False to reset mouse down state. |
SetPushed(Int32, Int32, Rectangle, Boolean)
Saves current pushed state.
Declaration
public void SetPushed(int rowIndex, int colIndex, Rectangle bounds, bool value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
System.Drawing.Rectangle | bounds | The System.Drawing.Rectangle with the bounds. |
System.Boolean | value | True to set the button as pushed; False to reset pushed state. |
Events
Clicked
Occurs when the cell button has clicked.
Declaration
public event GridCellEventHandler Clicked
Event Type
Type |
---|
GridCellEventHandler |
HoveringChanged
Occurs when hovers mouse over cell button or moved mouse away from cell button element.
Declaration
public event GridCellEventHandler HoveringChanged
Event Type
Type |
---|
GridCellEventHandler |
MouseDownChanged
Occurs when pressed or released the mouse button while the cursor was over the cell button element.
Declaration
public event GridCellEventHandler MouseDownChanged
Event Type
Type |
---|
GridCellEventHandler |
PushedChanged
Occurs when moved mouse away from cell button element or back into it while pressing the mouse.
Declaration
public event GridCellEventHandler PushedChanged
Event Type
Type |
---|
GridCellEventHandler |