在 ZedGraph 中,当您将鼠标悬停在图表上时,光标会从默认指针变为十字准线。我希望光标保持默认指针。但改变它,例如
zedGraphControl1.Cursor = Cursors.Arrow;
在设计器或代码中都没有影响。
有趣的是,我可以补充:
zedGraphControl1.UseWaitCursor = true;
并且当超过控制时它会显示一个沙漏。但以下内容:
zedGraphControl1.Cursor = Cursors.WaitCursor;
没有。顺便说一句,我将该行添加到 ZedGraph 演示程序之一中,因此我知道该程序可以正常工作。想法赞赏。
最佳答案
我没有足够的声誉通过接受的答案发表评论,但我认为这值得一提:
当使用 MouseMoveEvent
来覆盖光标时,返回一个 true
值以向 ZedGraph 表明您已经完全处理了该事件。请参阅以下文档中的片段:
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.
例如
private bool zedGraphControl1_MouseMoveEvent(ZedGraphControl sender, MouseEventArgs e)
{
this.Cursor = Cursors.Default;
return true
}
如果不这样做,您可能会在 ZedGraph 默认光标(十字线)和您选择作为覆盖光标的任何内容之间看到闪烁效果。
关于由 c# zedgraph : how to use the cursor property?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17241481/