Xceed Chart for WinForms v4.4 Documentation
Welcome to Xceed Chart for WinForms v4.4 / User Guide / Interactivity / Drag Operations / Cursors

In This Topic
    Cursors
    In This Topic

    Xceed Chart for WinForms can change the mouse cursor when it passes over chart elements. This is very useful when you want to visually prompt the end-user that something will happen when a chart element is clicked. To notify the control to change the mouse cursor when the mouse moves over the chart, you must add an object of type CursorChangeInteractivityOperation to the interactivity collection:

    VB.NET  
    chartControl1.InteractivityOperations.Add(New CursorChangeInteractivityOperation())
    
    C#  
    chartControl1.InteractivityOperations.Add(new CursorChangeInteractivityOperation());
    

    By default, chart elements do not change the mouse cursor. The following example changes the cursor to "hand" when the mouse passes over a data item:

    VB.NET  

    ' init the values for the tooltip properties
    chartControl.InteractivityOperations.Add(New CursorChangeInteractivityOperation())
    Dim chart As Chart = CType((chartControl.Charts(0)), Chart)

    ' Create a bar series
    Dim bar As BarSeries = CType(chart.Series.Add(SeriesType.Bar), BarSeries)

    bar.BarStyle = BarStyle.CutEdgeBar
    bar.Legend.Mode = SeriesLegendMode.DataPoints
    bar.Values.Add(20.0)
    bar.Values.Add(60.0)
    bar.Values.Add(50.0)
    bar.Values.Add(80.0)
    bar.Values.Add(60.0)

    bar.Interactivity.CursorMode = SeriesCursorMode.DataPoints
    bar.Interactivity.Cursors.Add(CType(CursorType.Hand, Object))
    bar.Interactivity.Cursors.Add(CType(CursorType.Hand, Object))
    bar.Interactivity.Cursors.Add(CType(CursorType.Hand, Object))
    bar.Interactivity.Cursors.Add(CType(CursorType.Hand, Object))
    bar.Interactivity.Cursors.Add(CType(CursorType.Hand, Object))

    ' set some fill effects in the collection.
    bar.Appearance.FillMode = AppearanceFillMode.DataPoints
    Dim fillEffect As FillEffect = New FillEffect(Color.Red)
    bar.Appearance.FillEffects.Add(fillEffect)
    C#  
    // init the values for the tooltip properties
    chartControl.InteractivityOperations.Add(new CursorChangeInteractivityOperation());
    Chart chart = (Chart)(chartControl.Charts[0]);
    // Create a bar series
    BarSeries bar = (BarSeries)chart.Series.Add(SeriesType.Bar);
    bar.BarStyle = BarStyle.CutEdgeBar;
    bar.Legend.Mode = SeriesLegendMode.DataPoints;
    bar.Values.Add(20.0);
    bar.Values.Add(60.0);
    bar.Values.Add(50.0);
    bar.Values.Add(80.0);
    bar.Values.Add(60.0);
    bar.Interactivity.CursorMode = SeriesCursorMode.DataPoints;
    bar.Interactivity.Cursors.Add((object)CursorType.Hand);
    bar.Interactivity.Cursors.Add((object)CursorType.Hand);
    bar.Interactivity.Cursors.Add((object)CursorType.Hand);
    bar.Interactivity.Cursors.Add((object)CursorType.Hand);
    bar.Interactivity.Cursors.Add((object)CursorType.Hand);
    // set some fill effects in the collection.
    bar.Appearance.FillMode = AppearanceFillMode.DataPoints;
    FillEffect fillEffect = new FillEffect(Color.Red);
    bar.Appearance.FillEffects.Add(fillEffect);

    Related Examples

    Windows Forms: Interactivity\Tooltips and Cursors 

    Web forms: Getting started\HTML image map, Getting started\HTML image map postback

    See Also

    ChartControl | SeriesInteractivity | Interactivity | HTML Image Map | HTML Image Map with Postback