使用 Zedgraph 重新映射鼠标控制?

发布于 2024-07-17 14:01:18 字数 215 浏览 3 评论 0原文

我正在使用 ZedGraph,我想通过按住 Ctrl 并用鼠标左键拖动框来缩放到选定区域,而不是用鼠标中键单击并拖动。

默认行为是仅使用鼠标左键进行缩放并使用鼠标中键进行平移,但我已经切换了这两种操作。

有谁知道如何通过单击并拖动左键(不按住 Ctrl)来调用平移,以及如何通过按住 Ctrl 然后单击并拖动左键来调用缩放?

I am using ZedGraph and I want to zoom to a selected area by holding down Ctrl and dragging the box with the left mouse button instead of clicking and dragging with the middle mouse button.

The default behavior is to zoom with just the left mouse button and to pan with the middle mouse button, but I have switched these two operations already.

Does anyone have any idea how to make panning be called by clicking and dragging with the left button (without holding down Ctrl) and zooming be called by holding down Ctrl and then clicking and dragging with the left button?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

初心 2024-07-24 14:01:18

ZedGraphControl 允许平移和缩放 通过控件的属性来控制缩放。 仅使用鼠标左键启用平移:

zg1.PanButtons = MouseButtons.Left;
zg1.PanModifierKeys = Keys.None;

并使用 Ctrl+鼠标左键启用缩放:

zg1.ZoomButtons = MouseButtons.Left;
zg1.ZoomModifierKeys = Keys.Control;

设计器属性窗口似乎不想让您只指定修饰符键的控制,因此您必须将其放置在代码中 - 例如,表单的 Load 事件处理程序。

The ZedGraphControl allows Pan & Zoom to be controlled through properties of the control. To enable panning with just the left mouse button:

zg1.PanButtons = MouseButtons.Left;
zg1.PanModifierKeys = Keys.None;

and to enable Zoom with Ctrl+Left mouse button:

zg1.ZoomButtons = MouseButtons.Left;
zg1.ZoomModifierKeys = Keys.Control;

The designer properties window doesn't seem to want to let you just specify Control for the Modifier Keys, so you'll have to put it in code - the Form's Load event handler, for example.

凯凯我们等你回来 2024-07-24 14:01:18

您是否通过代码尝试过:

zg.GraphPane.XAxis.Scale.Min = xxxx;
zg.GraphPane.XAxis.Scale.Max = yyyy;

//和

zgc.ScrollGrace = 0.1;

Have you try it by code using:

zg.GraphPane.XAxis.Scale.Min = xxxx;
zg.GraphPane.XAxis.Scale.Max = yyyy;

//and

zgc.ScrollGrace = 0.1;

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文