void MSGraphControl_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState, PointF mousePosition) { MSGraphPane pane = MasterPane.FindChartRect(mousePosition) as MSGraphPane; if (pane == null) { mousePosition = PointToClient(new Point(ContextMenuStrip.Left, ContextMenuStrip.Top)); } pane = MasterPane.FindChartRect(mousePosition) as MSGraphPane; if (pane == null) { return; } Graphics g = CreateGraphics(); pane.SetScale(g); if (IsSynchronizeXAxes) { foreach (MSGraphPane syncPane in MasterPane.PaneList) { if (syncPane == pane) { continue; } syncPane.SetScale(g); } } Refresh(); }
bool MSGraphControl_MouseMoveEvent(ZedGraphControl sender, MouseEventArgs e) { if (e.Button == MouseButtons.None) { return(false); } Point pos = MousePosition; pos = PointToClient(pos); MSGraphPane pane = MasterPane.FindChartRect(new PointF(pos.X, pos.Y)) as MSGraphPane; if (pane == null) { pos = PointToClient(new Point(ContextMenuStrip.Left, ContextMenuStrip.Top)); } pane = MasterPane.FindChartRect(new PointF(pos.X, pos.Y)) as MSGraphPane; if (pane == null) { return(false); } if ((IsEnableHPan) && ((e.Button == PanButtons && ModifierKeys == PanModifierKeys) || (e.Button == PanButtons2 && ModifierKeys == PanModifierKeys2))) { Graphics g = CreateGraphics(); pane.SetScale(g); } return(false); }
void MSGraphControl_MouseClick(object sender, MouseEventArgs e) { MSGraphPane pane = MasterPane.FindChartRect(e.Location) as MSGraphPane; if (pane != null && (IsEnableHZoom || IsEnableVZoom)) { if ((_unzoomButtons.MatchesEvent(e) && ModifierKeys == _unzoomModifierKeys) || (_unzoomButtons2.MatchesEvent(e) && ModifierKeys == _unzoomModifierKeys2)) { if (IsSynchronizeXAxes) { foreach (MSGraphPane syncPane in MasterPane.PaneList) { syncPane.ZoomStack.Pop(syncPane); } } else { pane.ZoomStack.Pop(pane); } } else if (_unzoomAllButtons.MatchesEvent(e) || _unzoomAllButtons2.MatchesEvent(e)) { if (IsSynchronizeXAxes) { foreach (MSGraphPane syncPane in MasterPane.PaneList) { syncPane.ZoomStack.PopAll(syncPane); } } else { pane.ZoomStack.PopAll(pane); } } else { return; } Graphics g = CreateGraphics(); if (IsSynchronizeXAxes) { foreach (MSGraphPane syncPane in MasterPane.PaneList) { syncPane.SetScale(g); } } else { pane.SetScale(g); } Refresh(); } }
public CurveItem AddGraphItem(MSGraphPane pane, IMSGraphItemInfo item, bool setScale) { if (item.GraphItemType != pane.CurrentItemType) { pane.CurveList.Clear(); pane.CurrentItemType = item.GraphItemType; pane.ZoomStack.PopAll(pane); item.CustomizeXAxis(pane.XAxis); item.CustomizeYAxis(pane.YAxis); } CurveItem newItem = makeMSGraphItem(item); pane.CurveList.Add(newItem); // If you are adding multiple graph items, it is quickest to set the scale // once at the end. if (setScale) { pane.SetScale(CreateGraphics()); } return(newItem); }
public CurveItem AddGraphItem( MSGraphPane pane, IMSGraphItemInfo item, bool setScale ) { if( item.GraphItemType != pane.CurrentItemType ) { pane.CurveList.Clear(); pane.CurrentItemType = item.GraphItemType; pane.ZoomStack.PopAll( pane ); item.CustomizeXAxis( pane.XAxis ); item.CustomizeYAxis( pane.YAxis ); } CurveItem newItem = makeMSGraphItem( item ); pane.CurveList.Add( newItem ); // If you are adding multiple graph items, it is quickest to set the scale // once at the end. if (setScale) pane.SetScale( CreateGraphics() ); return newItem; }