4mla1fn
4mla1fn

Reputation: 303

c# zedgraph: how to use the cursor property?

in ZedGraph, when you mouse over a graph, the cursor changes from the default pointer to a crosshair. i'd prefer the cursor remain the default pointer. but changing it, e.g.

zedGraphControl1.Cursor = Cursors.Arrow;

has no effect either in the designer or in the code.

interesting, i can add:

zedGraphControl1.UseWaitCursor = true;

and it will show an hourglass when over the control. but the following:

zedGraphControl1.Cursor = Cursors.WaitCursor;

does not. btw, i'm adding that line into one of the ZedGraph demo programs so i know the program works otherweise. ideas appreciated.

Upvotes: 1

Views: 2147

Answers (2)

VineAndBranches
VineAndBranches

Reputation: 426

I don't have enough reputation to leave a comment by the accepted answer, but I thought this was worth mentioning:

When using the MouseMoveEvent for the purpose of overriding the cursor, return a value of true to indicate to ZedGraph that you've completely handled the event. See snippet from documentation below:

Return true if you have handled the mouse event entirely, and you do not want the ZedGraphControl to do any further action (e.g., starting a zoom operation). Return false if ZedGraph should go ahead and process the mouse event.

e.g.

private bool zedGraphControl1_MouseMoveEvent(ZedGraphControl sender, MouseEventArgs e)
{
    this.Cursor = Cursors.Default;
    return true
}

If you don't, you may see a flicker effect between the ZedGraph default cursor (cross-hairs) and whatever you select as the overriding cursor.

Upvotes: 4

SanVEE
SanVEE

Reputation: 2060

Use the following:

zedGraphControl1.Cursor = Cursors.Default;

Upvotes: 2

Related Questions