Exemplo n.º 1
0
        private void SelectGraphAtPoint(Point screenPoint)
        {
            Point point = PointToClient(screenPoint);

            DataPlot dataPlot = GetDataPlotAtPoint(point);

            if (dataPlot != null)
            {
                int   index         = Plots.IndexOf((DataPlot)dataPlot);
                Point dataPlotPoint = dataPlot.PointToClient(screenPoint);
                if (dataPlotPoint.X > dataPlot.ClientRectangle.Right)
                {
                    if (Keys.IndexInRange(index))
                    {
                        ScrollControlIntoView(Keys[index]);
                    }
                }
                else
                {
                    ScrollControlIntoView(dataPlot);
                }

                if (index != SelectedGraphIndex && Graphs.IndexInRange(index))
                {
                    SelectedGraph = Graphs[index];
                }
            }
        }
Exemplo n.º 2
0
        private void AddGraphDetails(DesignedGraph designedGraph, int index)
        {
            int y = (GRAPH_HEIGHT + CONTROL_PADDING) * index;

            if (VScroll)
            {
                y = y - VerticalScroll.Value;
            }

            DataPlot newplot =
                CreatePlot(new Point(CONTROL_LEFT - HorizontalScroll.Value, CONTROL_PADDING + y));

            int left = ClientSize.Width - (KEY_WIDTH + (2 * CONTROL_PADDING));

            if (left < GRAPH_MIN_WIDTH + (2 * CONTROL_PADDING))
            {
                left = GRAPH_MIN_WIDTH + (2 * CONTROL_PADDING);
            }
            DataKey newkey =
                CreateKey(new Point(left - HorizontalScroll.Value, CONTROL_PADDING + y + GRAPH_PADDING));

            foreach (DataSourceItem item in designedGraph.DataSources)
            {
                newkey.DataSourceUUIDsToShow.Add(item.Uuid);
            }
            newplot.DataKey          = newkey;
            newkey.Enter            += new EventHandler(dataKey_Enter);
            newkey.MouseDown        += new MouseEventHandler(dataKey_MouseDown);
            newkey.MouseDoubleClick += new MouseEventHandler(dataKey_MouseDoubleClick);
            newkey.UpdateItems();
            newplot.DisplayName       = designedGraph.DisplayName;
            newplot.MouseDown        += new MouseEventHandler(dataPlot_MouseDown);
            newplot.MouseDoubleClick += new MouseEventHandler(dataPlot_MouseDoubleClick);
            newplot.RefreshBuffer();
        }
Exemplo n.º 3
0
        private DataPlot GetDataPlotAtPoint(Point point)
        {
            point.X = CONTROL_LEFT;
            DataPlot dataPlot = GetChildAtPoint(point) as DataPlot;

            if (dataPlot == null)
            {
                point.Y += CONTROL_PADDING;
                dataPlot = GetChildAtPoint(point) as DataPlot;
            }
            return(dataPlot);
        }
Exemplo n.º 4
0
        private void dataPlot_MouseDown(object sender, MouseEventArgs e)
        {
            DataPlot dataPlot = sender as DataPlot;

            if (dataPlot != null)
            {
                Point screenPoint = dataPlot.PointToScreen(e.Location);
                SelectGraphAtPoint(screenPoint);
                Point clientPoint = PointToClient(screenPoint);
                base.OnMouseDown(new MouseEventArgs(e.Button, e.Clicks, clientPoint.X, clientPoint.Y, e.Delta));
            }
        }
Exemplo n.º 5
0
        private DataPlot CreatePlot(Point location)
        {
            DataPlot plot = new DataPlot();

            plot.ArchiveMaintainer = ArchiveMaintainer;
            plot.DataPlotNav       = DataPlotNav;
            plot.DataEventList     = DataEventList;
            plot.Location          = location;
            plot.Size        = new Size(ClientSize.Width - (KEY_WIDTH + (CONTROL_PADDING * 3)), GRAPH_HEIGHT);
            plot.MinimumSize = new Size(GRAPH_MIN_WIDTH, GRAPH_HEIGHT);
            plot.Padding     = new Padding(GRAPH_PADDING, GRAPH_PADDING, GRAPH_PADDING + GRAPH_YAXIS_LABEL_WIDTH, GRAPH_PADDING);
            plot.Anchor      = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
            Plots.Add(plot);
            this.Controls.Add(plot);
            return(plot);
        }
Exemplo n.º 6
0
 private DataPlot CreatePlot(Point location)
 {
     DataPlot plot = new DataPlot();
     plot.ArchiveMaintainer = ArchiveMaintainer;
     plot.DataPlotNav = DataPlotNav;
     plot.DataEventList = DataEventList;
     plot.Location = location;
     plot.Size = new Size(ClientSize.Width - (KEY_WIDTH + (CONTROL_PADDING * 3)), GRAPH_HEIGHT);
     plot.MinimumSize = new Size(GRAPH_MIN_WIDTH, GRAPH_HEIGHT);
     plot.Padding = new Padding(GRAPH_PADDING, GRAPH_PADDING, GRAPH_PADDING + GRAPH_YAXIS_LABEL_WIDTH, GRAPH_PADDING);
     plot.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
     Plots.Add(plot);
     this.Controls.Add(plot);
     return plot;
 }