void ZedGraphControlPlus_ContextMenuBuilder(object sender, ZedGraphControlPlus.ContextMenuBuilderEventArgs args)
        {
            var items = args.MenuStrip.Items;

            items.Add(new ToolStripSeparator());

            {
                var ppl   = args.Row;
                int index = args.Index;
                if (ppl != null && index > 0 && index < ppl.Count && ppl.PLSreference != null)
                {
                    byte collectorNumber = (byte)((ZedGraphControlPlus)sender).Tag;

                    ushort step = (ushort)ppl.PLSreference.Step[index].X;

                    items.Add(new ToolStripMenuItem("Добавить точку в редактор", null,
                                                    (s, e) => {
                        var form = new AddPointForm(step, collectorNumber);
                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            Graph.PointToAdd = form.PointToAdd;
                        }
                    }));

                    items.Add(new ToolStripMenuItem("Коэффициент коллектора " + collectorNumber, null,
                                                    (s, e) => Modified |= new SetScalingCoeffForm(step, collectorNumber, graph != Graph.MeasureGraph.Instance, graph.setScalingCoeff).ShowDialog() == DialogResult.Yes));
                    {
                        var ped = ppl.PEDreference;
                        items.Add(new ToolStripMenuItem("Вычесть из текущего с перенормировкой на точку", null,
                                                        (s, e) => GraphForm_OnDiffOnPoint(step, collectorNumber, ped)));
                        if (ped != null)
                        {
                            items.Add(new ToolStripMenuItem("Вычесть из текущего с перенормировкой на интеграл пика", null,
                                                            (s, e) => GraphForm_OnDiffOnPoint(ushort.MaxValue, null, ped)));
                        }
                    }
                    items.Add(new ToolStripSeparator());
                }
            }

            var stepViewItem    = new ToolStripMenuItem("Ступени", null, (s, e) => graph.AxisDisplayMode = ScalableDataList.DisplayValue.Step);
            var voltageViewItem = new ToolStripMenuItem("Напряжение", null, (s, e) => graph.AxisDisplayMode = ScalableDataList.DisplayValue.Voltage);
            var massViewItem    = new ToolStripMenuItem("Масса", null, (s, e) => graph.AxisDisplayMode = ScalableDataList.DisplayValue.Mass);

            switch (graph.AxisDisplayMode)
            {
            case ScalableDataList.DisplayValue.Step:
                stepViewItem.Checked = true;
                break;

            case ScalableDataList.DisplayValue.Voltage:
                voltageViewItem.Checked = true;
                break;

            case ScalableDataList.DisplayValue.Mass:
                massViewItem.Checked = true;
                break;
            }

            items.Add(new ToolStripMenuItem("Выбрать шкалу", null, stepViewItem, voltageViewItem, massViewItem));
        }
Beispiel #2
0
        void ZedGraphControlPlus_ContextMenuBuilder(object sender, ZedGraphControlPlus.ContextMenuBuilderEventArgs args)
        {
            var items = args.MenuStrip.Items;
            items.Add(new ToolStripSeparator());

            {
                var ppl = args.Row;
                int index = args.Index;
                if (ppl != null && index > 0 && index < ppl.Count && ppl.PLSreference != null) {
                    byte collectorNumber = (byte)((ZedGraphControlPlus)sender).Tag;

                    ushort step = (ushort)ppl.PLSreference.Step[index].X;

                    items.Add(new ToolStripMenuItem("Добавить точку в редактор", null,
                        (s, e) => {
                            var form = new AddPointForm(step, collectorNumber);
                            if (form.ShowDialog() == DialogResult.OK) {
                                Graph.PointToAdd = form.PointToAdd;
                            }
                        }));

                    items.Add(new ToolStripMenuItem("Коэффициент коллектора " + collectorNumber, null,
                        (s, e) => Modified |= new SetScalingCoeffForm(step, collectorNumber, graph != Graph.MeasureGraph.Instance, graph.setScalingCoeff).ShowDialog() == DialogResult.Yes));
                    {
                        var ped = ppl.PEDreference;
                        items.Add(new ToolStripMenuItem("Вычесть из текущего с перенормировкой на точку", null,
                            (s, e) => GraphForm_OnDiffOnPoint(step, collectorNumber, ped)));
                        if (ped != null) {
                            items.Add(new ToolStripMenuItem("Вычесть из текущего с перенормировкой на интеграл пика", null,
                                (s, e) => GraphForm_OnDiffOnPoint(ushort.MaxValue, null, ped)));
                        }
                    }
                    items.Add(new ToolStripSeparator());
                }
            }

            var stepViewItem = new ToolStripMenuItem("Ступени", null, (s, e) => graph.AxisDisplayMode = ScalableDataList.DisplayValue.Step);
            var voltageViewItem = new ToolStripMenuItem("Напряжение", null, (s, e) => graph.AxisDisplayMode = ScalableDataList.DisplayValue.Voltage);
            var massViewItem = new ToolStripMenuItem("Масса", null, (s, e) => graph.AxisDisplayMode = ScalableDataList.DisplayValue.Mass);

            switch (graph.AxisDisplayMode) {
                case ScalableDataList.DisplayValue.Step:
                    stepViewItem.Checked = true;
                    break;
                case ScalableDataList.DisplayValue.Voltage:
                    voltageViewItem.Checked = true;
                    break;
                case ScalableDataList.DisplayValue.Mass:
                    massViewItem.Checked = true;
                    break;
            }

            items.Add(new ToolStripMenuItem("Выбрать шкалу", null, stepViewItem, voltageViewItem, massViewItem));
        }