Example #1
0
        public ThresholdMarker(ILineGraph graph, GLPoint location, GLSize size, GLColor color) {
            _graph = graph;
            _rectangle = new Rectangle(color, true, location, size);
            _rectangle.Origin = new GLPoint(_rectangle.Origin.X - size.Width / 2.0, _rectangle.Origin.Y - size.Height / 2.0);

            graph.Control.MouseMove += OnMouseMove;
            graph.Control.MouseDown += OnMouseDown;
            graph.Control.MouseUp += OnMouseUp;
        }
Example #2
0
        public ThresholdMarker(ILineGraph graph, GLPoint location, GLSize size, GLColor color)
        {
            _graph            = graph;
            _rectangle        = new Rectangle(color, true, location, size);
            _rectangle.Origin = new GLPoint(_rectangle.Origin.X - size.Width / 2.0, _rectangle.Origin.Y - size.Height / 2.0);

            graph.Control.MouseMove += OnMouseMove;
            graph.Control.MouseDown += OnMouseDown;
            graph.Control.MouseUp   += OnMouseUp;
        }
Example #3
0
        public Form1()
        {
            InitializeComponent();
            if (DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                return;
            }

            _graph = new LineGraph();

            _graph.Control.Dock = DockStyle.Fill;

            Controls.Add(_graph.Control);

            Load += delegate {
                ShowStaticGraph();
            };

            _graph.Control.MouseClick += (s, args) => {
                if (args.Button == MouseButtons.Right)
                {
                    var origin = _graph.Window.ScreenToView(new GLPoint(args.Location.X, args.Location.Y));
                    var size   = new GLSize(10, 1);

                    var group1 = new MenuItem("Group 1");
                    group1.Click += delegate {
                        _graph.Markers.Add(new ThresholdMarker(_graph, origin, size, Color.HotPink.ToGLColor()));
                        _graph.Draw();
                    };

                    var group2 = new MenuItem("Group 2");
                    group2.Click += delegate {
                        _graph.Markers.Add(new ThresholdMarker(_graph, origin, size, Color.Blue.ToGLColor()));
                        _graph.Draw();
                    };

                    var nox = new MenuItem("No Explosive");
                    nox.Click += delegate {
                        _graph.Markers.Add(new ThresholdMarker(_graph, origin, size, Color.Aqua.ToGLColor()));
                        _graph.Draw();
                    };

                    var ofb = new MenuItem("Out Of Bounds");
                    ofb.Click += delegate {
                        _graph.Markers.Add(new ThresholdMarker(_graph, origin, size, Color.Yellow.ToGLColor()));
                        _graph.Draw();
                    };

                    var dnt = new MenuItem("DNT");
                    dnt.Click += delegate {
                        _graph.Markers.Add(new ThresholdMarker(_graph, origin, size, Color.Orange.ToGLColor()));
                        _graph.Draw();
                    };

                    var explosive = new MenuItem("Explosive");
                    explosive.Click += delegate {
                        _graph.Markers.Add(new ThresholdMarker(_graph, origin, size, Color.Maroon.ToGLColor()));
                        _graph.Draw();
                    };

                    var peroxide = new MenuItem("Peroxide");
                    peroxide.Click += delegate {
                        _graph.Markers.Add(new ThresholdMarker(_graph, origin, size, Color.Green.ToGLColor()));
                        _graph.Draw();
                    };

                    var menu = new ContextMenu {
                        MenuItems =
                        {
                            group1,
                            group2,
                            nox,
                            ofb,
                            dnt,
                            explosive,
                            peroxide
                        }
                    };
                    menu.Show(_graph.Control, args.Location);
                }
            };
        }
Example #4
0
        public Form1() {
            InitializeComponent();
            if (DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime) return;



            _graph = new LineGraph();

            _graph.Control.Dock = DockStyle.Fill;

            Controls.Add(_graph.Control);

            Load += delegate {
                ShowStaticGraph();
            };

            _graph.Control.MouseClick += (s, args) => {
                if (args.Button == MouseButtons.Right) {
                    var origin = _graph.Window.ScreenToView(new GLPoint(args.Location.X, args.Location.Y));
                    var size = new GLSize(10, 1);

                    var group1 = new MenuItem("Group 1");
                    group1.Click += delegate {
                        _graph.Markers.Add(new ThresholdMarker(_graph, origin, size, Color.HotPink.ToGLColor()));
                        _graph.Draw();
                    };

                    var group2 = new MenuItem("Group 2");
                    group2.Click += delegate {
                        _graph.Markers.Add(new ThresholdMarker(_graph, origin, size, Color.Blue.ToGLColor()));
                        _graph.Draw();
                    };

                    var nox = new MenuItem("No Explosive");
                    nox.Click += delegate {
                        _graph.Markers.Add(new ThresholdMarker(_graph, origin, size, Color.Aqua.ToGLColor()));
                        _graph.Draw();
                    };

                    var ofb = new MenuItem("Out Of Bounds");
                    ofb.Click += delegate {
                        _graph.Markers.Add(new ThresholdMarker(_graph, origin, size, Color.Yellow.ToGLColor()));
                        _graph.Draw();
                    };

                    var dnt = new MenuItem("DNT");
                    dnt.Click += delegate {
                        _graph.Markers.Add(new ThresholdMarker(_graph, origin, size, Color.Orange.ToGLColor()));
                        _graph.Draw();
                    };

                    var explosive = new MenuItem("Explosive");
                    explosive.Click += delegate {
                        _graph.Markers.Add(new ThresholdMarker(_graph, origin, size, Color.Maroon.ToGLColor()));
                        _graph.Draw();
                    };

                    var peroxide = new MenuItem("Peroxide");
                    peroxide.Click += delegate {
                        _graph.Markers.Add(new ThresholdMarker(_graph, origin, size, Color.Green.ToGLColor()));
                        _graph.Draw();
                    };

                    var menu = new ContextMenu {
                        MenuItems = {
                            group1,
                            group2,
                            nox,
                            ofb,
                            dnt,
                            explosive,
                            peroxide
                        }
                    };
                    menu.Show(_graph.Control, args.Location);
                }
            };
        }