Dundas Chart for Windows Forms
ButtonType Property
See Also  Example Send comments on this topic.
DundasWinChart Assembly > Dundas.Charting.WinControl Namespace > ScrollBarEventArgs Class : ButtonType Property


Gets the type of scrollbar button that the end-user clicked on.
Type of the scroll button clicked.

Syntax

Visual Basic (Declaration)  
Public ReadOnly Property ButtonType As ScrollBarButtonType
Visual Basic (Usage) Copy Code
Dim instance As ScrollBarEventArgs
Dim value As ScrollBarButtonType
 
value = instance.ButtonType
C#  
public ScrollBarButtonType ButtonType {get;}

Return Value

A ScrollBarButtonType enumeration value that represents the scrollbar element the end-user clicked on.

Example

In this example we override the default behavior when the user clicks on the reset button.  Normally clicking on the reset button will result in the previous view being displayed, but using the AxisScrollBarClicked event we reset the view to its original state (i.e. no zooming).  We only do this for the X axis of a chart area named "Default".
C# Copy Code
// Note that events in C# should be added via the Events button in the Properties window, so
//   that the necessary code is added to InitializeComponent()
private void chart1_AxisScrollBarClicked(object sender, Dundas.Charting.WinControl.ScrollBarEventArgs e)
{

   
// First check for zoom/reset button being clicked for X axis in chart area named "Default"
   
if(e.ChartArea.Name == "Default")
   {
       
if(e.Axis.Type == AxisName.X)
       {
           
if(e.ButtonType == ScrollBarButtonType.ZoomReset)
           {
               
// Reset view to original view (no zooming)
               
e.Axis.View.ZoomReset(0);
               
               
// further handling of event is not required
               
e.Handled = true;
           }
       }
   }
}
Visual Basic Copy Code
Imports Dundas.Charting.WinControl
...

Private Sub chart1_AxisScrollBarClicked(ByVal sender As Object, _
ByVal e As Dundas.Charting.WinControl.ScrollBarEventArgs) Handles chart1.AxisScrollBarClicked

    'first check for zoom/reset button being clicked for X axis in chart area named "Default"
    If e.ChartArea.Name = "Default" Then

        If e.Axis.Type = AxisName.X Then

            If e.ButtonType = ScrollBarButtonType.ZoomReset Then

                ' Reset view to original view (no zooming)
                e.Axis.View.ZoomReset(0)

                ' further handling of event is not required
                e.Handled = True
            End If
        End If
    End If
End Sub

Remarks

This property is exposed in the AxisScrollBarClicked event of the root Chart object, and can be used to determine what scrollbar element the end-user clicked on.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2009 All Rights Reserved.