Spread Windows Forms 12.0 Product Documentation
GetRowViewportIndexFromY Method (FpSpread)
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > FpSpread Class : GetRowViewportIndexFromY Method
Y-coordinate
Gets the index of the viewport row for the specified coordinate for the active sheet.
Syntax
'Declaration
 
Public Function GetRowViewportIndexFromY( _
   ByVal y As Integer _
) As Integer
'Usage
 
Dim instance As FpSpread
Dim y As Integer
Dim value As Integer
 
value = instance.GetRowViewportIndexFromY(y)
public int GetRowViewportIndexFromY( 
   int y
)

Parameters

y
Y-coordinate

Return Value

Integer index of viewport row
Remarks

This method (along with GetColumnViewportIndexFromX) allows you to retrieve the index of the viewport row or viewport column from pixel offsets. This is useful in mouse-handling to see in which viewport a mouse event (MouseDown, MouseMove, etc.) occurred.

The viewport row index is zero-based, so the first (top) viewport row has an index of 0.

Example
This example returns the viewport the user clicks in.
private void fpSpread1MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
     int i;
     i = fpSpread1.GetRootWorkbook.GetRowViewportIndexFromY(e.Y);
     Debug.WriteLine(i.ToString);
}
Private Sub FpSpread1MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles FpSpread1.MouseDown
     Dim i As Integer
     i = FpSpread1.GetRootWorkbook.GetRowViewportIndexFromY(e.X)
     Debug.WriteLine(i.ToString)
End Sub
See Also

Reference

FpSpread Class
FpSpread Members