Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
195
Change mouse cursor over labels on Gantt chart
posted

Is there a way of having the mouse cursor automatically change to a hand when the mouse is over the Y axis label?

If I try to code it myself in the MouseMove event, I can change it to a hand but it immediately changes back again.

Note, I'm using version 8.1.

Thanks,

Mark

  • 26458
    Suggested Answer
    Offline posted

    Sorry for a delayed response, Mark. You can do this if you enable hittest and a tooltip on these labels. Then you can use DataItemOver and Out events to change the cursor. You'd also have to turn the tooltip off temporarily while the cursor is over the label. Not the cleanest approach, but i don't think there's another way of doing this.

    private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
    {
        //set text capabilities for all Y axis labels
        foreach (Primitive p in e.SceneGraph)
        {
           Text label = p as Text;
            if (label != null && label.Path != null && label.Path.IndexOf("Y") != -1)
            {
                label.Row = label.Column = 0;
                label.Caps = PCaps.HitTest | PCaps.Tooltip;
            }
        }
    }

    void ultraChart1_DataItemOut(object sender, Infragistics.UltraChart.Shared.Events.ChartDataEventArgs e)
    {
        this.ultraChart1.Cursor = Cursors.Arrow;
        this.ultraChart1.Tooltips.Display = TooltipDisplay.MouseMove;
    }

    void ultraChart1_DataItemOver(object sender, Infragistics.UltraChart.Shared.Events.ChartDataEventArgs e)
    {
        if (e.Primitive is Text)
        {
            this.ultraChart1.Cursor = Cursors.Hand;
            this.ultraChart1.Tooltips.Display = TooltipDisplay.Never;
        }
    }