Spread Windows Forms 12.0 Product Documentation
Customizing the Display of the Pointer
Spread Windows Forms 12.0 Product Documentation > Developer's Guide > Customizing the Sheet Appearance > Customizing the Appearance of the Overall Component > Customizing the Display of the Pointer

You can set the cursor or pointer to appear differently for different parts of the display. To determine the pointer to display, use the GetCursor method and SetCursor method and the CursorType enumeration. The code for setting the pointer to change when it is over a header cell, as shown in this figure, is given in the example below.

Hand cursor over header cells

The Spread component uses one pointer for locked cells (CursorType enumeration equal to Locked) and one pointer for unlocked cells (CursorType enumeration equal to Normal). The component does not support different pointers for each cell type.

Cell Types and Reserved Locations

The built-in hyperlink cell type by default uses the hand pointer over the link area. For more information, refer to Setting a Hyperlink Cell.

Some cell types (for example, button, check box, combo box, and hyperlink) reserve areas within the cell that require special mouse processing. For example, clicking a mouse button while over the drop-down button in a combo box cell immediately enters edit mode. The location of the special area and the pointer used over the special area is determined by the IsReservedLocation and GetReservedCursor methods in the cell type classes. If you do not like the pointer supplied by a built-in cell type class then you could derive a class from the built-in cell type class and override the GetReservedCursor method.

The GetReservedCursor method is only called for locations where IsReservedLocation returns non-null. By returning null (Nothing in VB) or non-null, the IsReservedLocation method essentially divides the cell rectangle into two subregions (normal region and reserved region). In the normal subregion, a mouse down is processed by the Spread component and starts a cell selection. Since the mouse down is processed by the Spread component, the mouse pointer is determined by the Spread component (that is, GetReservedCursor is not called). In the reserved subregion, a mouse down immediately starts a cell edit and the mouse down gets passed to the cell editor for processing. Since the mouse down is processed by the cell editor, the mouse pointer is determined by the cell type via the GetReservedCursor method. While you can supply cell type specific pointers for the reserved subregion, you can not supply cell type specific pointers for the normal subregions.

Example

This example sets the pointer to display as a hand as shown in the figure above.

C#
Copy Code
private void Form1_Load(object sender, System.EventArgs e){
 // Change the pointer shape on column headers.
 fpSpread1.SetCursor(FarPoint.Win.Spread.CursorType.ColumnHeader, System.Windows.Forms.Cursors.Hand);
}
VB
Copy Code
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
 ' Change the pointer shape on column headers.
 fpSpread1.SetCursor(FarPoint.Win.Spread.CursorType.ColumnHeader, System.Windows.Forms.Cursors.Hand)
End Sub