Spread Windows Forms 12.0 Product Documentation
GetColumnHeaderCellFromPixel(Int32,Int32) Method

FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > SpreadView Class > GetColumnHeaderCellFromPixel Method : GetColumnHeaderCellFromPixel(Int32,Int32) Method
X-coordinate (in pixels) of the pointer location
Y-coordinate (in pixels) of the pointer location
Gets the row and column indexes of the column header cell at the specified pointer location.
Public Overloads Function GetColumnHeaderCellFromPixel( _
   ByVal x As Integer, _
   ByVal y As Integer _
) As CellRange
Dim instance As SpreadView
Dim x As Integer
Dim y As Integer
Dim value As CellRange
value = instance.GetColumnHeaderCellFromPixel(x, y)
public CellRange GetColumnHeaderCellFromPixel( 
   int x,
   int y


X-coordinate (in pixels) of the pointer location
Y-coordinate (in pixels) of the pointer location

Return Value

CellRange object containing the row and column indexes (in a ) for the cell located at the specified pointer location, or (-1, -1, 0, 0) if no cell is located at the specified location

This method returns a CellRange object that consists of row and column coordinates and row and column counts. If a cell exists at the pixel location, then the method returns CellRange(row, column, 1, 1) where row, column are the row index and column index of the cell. If a cell does not exist at the pixel location then the method returns CellRange(-1, -1, 0, 0).

Use the x and y parameters to specify the location (pixel) on the display of the pointer (or cursor).

This method only returns cell information for pixel locations in the column headers of the sheet, and not for cells in the data area or the sheet corner or other parts of the Spread component. For cells in the data area, use GetCellFromPixel methods. For cells in the row headers, use the GetRowHeaderCellFromPixel methods.

This example uses the GetColumnHeaderCellFromPixel method.
private void fpSpread1MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) 
    FarPoint.Win.Spread.SpreadView sv = fpSpread1.GetRootWorkbook();

    FarPoint.Win.Spread.Model.CellRange cr;

    cr = sv.GetColumnHeaderCellFromPixel(e.X, e.Y);
    textBox1.Text = "You are in column header " + cr.Column.ToString();
Private Sub FpSpread1MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles FpSpread1.MouseDown
    Dim sv As FarPoint.Win.Spread.SpreadView = FpSpread1.GetRootWorkbook()

    Dim cr As FarPoint.Win.Spread.Model.CellRange
    cr = sv.GetColumnHeaderCellFromPixel(e.X, e.Y)
    TextBox1.Text = "You are in column header " & cr.Column.ToString()
End Sub
See Also


SpreadView Class
SpreadView Members
Overload List