我在尝试同步佐德图中选定窗格的X轴,
目前我有三个窗格:

借助折叠属性,我可以同步所有可用窗格的X轴:
zedGraphControl1.IsSynchronizeXAxes = true;但是我只想同步Pane-1和Pane-3,有可能吗?
谢谢你抽出时间.)
发布于 2013-11-28 19:36:10
是的。
基本上,您必须连接到ZoomEvent,然后捕获已被平移或缩放的窗格,使用FindPane,将其缩尺Min和Max属性应用于其他属性,如果其他缩放属性设置为Auto,则执行AxisChange。
假设要排除的GraphPane对象是excludedGraphPane
void zedGraphControl1_ZoomEvent(ZedGraph.ZedGraphControl z, ZedGraph.ZoomState oldState, ZedGraph.ZoomState newState)
{
GraphPane pane;
using (var g = z.CreateGraphics())
pane = z.MasterPane.FindPane(z.PointToClient(MousePosition));
// The excludedGraphPane has to remain independant
if (pane == null || pane == excludedGraphPane)
return;
foreach (var gp in z.MasterPane.PaneList)
{
if (gp == pane || gp == excludedGraphPane)
continue;
gp.XAxis.Scale.Min = pane.XAxis.Scale.Min;
gp.XAxis.Scale.Max = pane.XAxis.Scale.Max;
gp.AxisChange(); // Only necessary if one or more scale property is set to Auto.
}
z.Invalidate();
}当然,由于同步现在是手动完成的,所以需要设置
zedGraphControl1.IsSynchronizeXAxes = false;https://stackoverflow.com/questions/20240971
复制相似问题