zedgraph EnableWheelZoom,缩放后如何获取轴值? [英] zedgraph EnableWheelZoom, how to get axis values after zooming?
问题描述
在我的 vb.net 项目中,我使用 zedgraph 绘制图形.我发现以下属性可以很好地缩放鼠标中心的图形.
In my vb.net project, I use zedgraph to draw figures. I find that the following properties work well to zoom figure on the center of mouse.
Friend WithEvents gcMain As ZedGraph.ZedGraphControl
Me.gcMain.IsZoomOnMouseCenter = True
Me.gcMain.IsEnableWheelZoom = True
我有两个工具条文本框来显示 x 轴的最小值和最大值.当我更改文本框中的值时,x 轴会发生变化.以下代码显示了处理文本框的示例.但是,当使用 IsEnableWheelZoom 属性缩放图形时,我不知道如何更新文本框中的值.在zedgraph中,ZedGraphControl_MouseWheel是一个受保护的事件.
I have two toolstrip text boxes to show the minimum and maximum values of x axis. When I change values in text boxes, the x axis changes. The following code shows an example of handling the textbox. However I do not know how to update values in text boxes when the figure is zoomed by using IsEnableWheelZoom property. In zedgraph, ZedGraphControl_MouseWheel is a protected event.
Friend WithEvents tbxRangeStart As System.Windows.Forms.ToolStripTextBox
Private Sub tbxRangeStart_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tbxRangeStart.KeyDown
Try
If e.KeyCode = Keys.Enter Then
' Change x Axis here
End If
Catch
End Try
End Sub
推荐答案
使用ZoomEvent
:
chart.ZoomEvent += chart_ZoomEvent
...
private void chart_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState)
{
textBoxMax.Text = chart.GraphPane.XAxis.Scale.Max.ToString();
textBoxMin.Text = chart.GraphPane.XAxis.Scale.Min.ToString();
}
这篇关于zedgraph EnableWheelZoom,缩放后如何获取轴值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!