简体   繁体   English

c#zedgraph:如何使用cursor属性?

[英]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. 在ZedGraph中,当您将鼠标悬停在图形上时,光标将从默认指针变为十字准线。 i'd prefer the cursor remain the default pointer. 我希望光标保持默认指针。 but changing it, eg 但是改变它,例如

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. 顺便说一句,我将那条线添加到ZedGraph演示程序之一中,所以我知道该程序可以正常工作。 ideas appreciated. 想法表示赞赏。

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. 当使用MouseMoveEvent来覆盖光标时,请返回true值以指示ZedGraph您已完全处理了该事件。 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 (eg, starting a zoom operation). 如果您已经完全处理了鼠标事件,并且您不希望ZedGraphControl进行任何进一步的操作(例如,启动缩放操作),则返回true。 Return false if ZedGraph should go ahead and process the mouse event. 如果ZedGraph应该继续处理鼠标事件,则返回false。

eg 例如

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. 否则,您可能会在ZedGraph默认光标(十字线)和您选择的任何替代光标之间看到闪烁效果。

使用以下内容:

zedGraphControl1.Cursor = Cursors.Default;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM