property ScrollBar.PartFromPoint (X as OLE_XPOS_PIXELS, Y as OLE_YPOS_PIXELS) as PartEnum
Retrieves the part from the point.

TypeDescription
X as OLE_XPOS_PIXELS A single that specifies the current X location of the mouse pointer. The x values is always expressed in client coordinates.
Y as OLE_YPOS_PIXELS A single that specifies the current X location of the mouse pointer. The x values is always expressed in client coordinates.
PartEnum A PartEnum expression that indicates the part from the point.
The PartFromPoint property specifies the part of the control from the cursor. Use the ValueFromPoint property to determine the value from the cursor. Use the VisiblePart or VisibleParts property to specify the visible parts of the control.

The following VB sample jumps to the value from the point when the user clicks the upper or lower part of the control:

Private Sub ScrollBar1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    With ScrollBar1
        If (0 <> (.PartFromPoint(-1, -1) And exBackgroundPart)) Then
            .Value = .ValueFromPoint(-1, -1)
        End If
    End With
End Sub

The following VB.NET sample jumps to the value from the point when the user clicks the upper or lower part of the control:

Private Sub AxScrollBar1_MouseDownEvent(ByVal sender As System.Object, ByVal e As AxEXSCROLLBARLib._IScrollBarEvents_MouseDownEvent) Handles AxScrollBar1.MouseDownEvent
    With AxScrollBar1
        If (0 <> (.get_PartFromPoint(-1, -1) And EXSCROLLBARLib.PartEnum.exBackgroundPart)) Then
            .Value = .get_ValueFromPoint(-1, -1)
        End If
    End With
End Sub

The following C++ sample jumps to the value from the point when the user clicks the upper or lower part of the control:

void OnMouseDownScrollbar1(short Button, short Shift, long X, long Y) 
{
	if ( m_scrollbar.GetPartFromPoint(-1,-1) & 640 )
		m_scrollbar.SetValue( m_scrollbar.GetValueFromPoint(-1,-1) );
}

The following C# sample jumps to the value from the point when the user clicks the upper or lower part of the control:

private void axScrollBar1_MouseDownEvent(object sender, AxEXSCROLLBARLib._IScrollBarEvents_MouseDownEvent e)
{
    if ( 0 != ( axScrollBar1.get_PartFromPoint(-1,-1) & EXSCROLLBARLib.PartEnum.exBackgroundPart ) )
        axScrollBar1.Value = axScrollBar1.get_ValueFromPoint(-1, -1);
}

The following VFP sample jumps to the value from the point when the user clicks the upper or lower part of the control:

*** ActiveX Control Event ***
LPARAMETERS button, shift, x, y

with thisform.scrollbar1
	if ( 0 # bitand( .PartFromPoint(-1,-1), 640) )
		.Value = .ValueFromPoint(-1,-1)
	endif
endwith