Example #1
0
        // Вызов окна Кластер чарт
        private void btClasterWindow_Click(object sender, EventArgs e)
        {
            WindowCluster windowCluster = new WindowCluster(connector);

            windowCluster.Show();
        }
Example #2
0
        public WindowGL(SimpleOpenGlControl Ch, WindowCluster wcl, Timer tm, bool reall)
        {
            real   = reall;
            timer1 = tm;
            Window = wcl;
            select = Selected.None;
            Chart  = Ch;

            Chart.Resize += delegate(object sender, EventArgs args) // Событие изменения размеров окна вывода
            {
                GluLoad();
                if (DrawSer != null && DrawSer.Load)
                {
                    //   BarsDraw.Dispose();
                    //   BarsDraw.Add(Sec);
                    Plot();
                }
            };

            #region События от мышки
            // Отслеживаем где была нажата кнопка мыши
            Chart.MouseDown += delegate(object sender, MouseEventArgs e)
            {
                xS = e.X;
                yS = e.Y;
                if (xS > Chart.Width - Axis.widthY)
                {
                    if (yS < Chart.Height - Axis.highX)
                    {
                        select = Selected.Y;
                        scY    = yS;
                    }
                }
                else
                {
                    if (yS > Chart.Height - Axis.highX)
                    {
                        if (xS < Chart.Width - Axis.widthY)
                        {
                            select = Selected.X;
                            scX    = xS;
                        }
                    }
                    else
                    {
                        if (timer1.Enabled)
                        {
                            timer1.Enabled = false;
                        }
                        select = Selected.Chart;
                    }
                }
            };
            Chart.MouseUp += delegate(object sender, MouseEventArgs e)
            {
                if (select == Selected.Chart)
                {
                    //if (real)
                    timer1.Enabled = true;
                }
                select = Selected.None;
            };
            // Перемещение мышки
            Chart.MouseMove += delegate(object sender, MouseEventArgs e)
            {
                switch (select)
                {
                case Selected.None:         // Выбора нет
                    break;

                case Selected.Chart:        // По графику
                    X0 += e.Location.X - xS;
                    Y0 -= e.Location.Y - yS;
                    xS  = e.Location.X;
                    yS  = e.Location.Y;
                    if (DrawSer != null && DrawSer.Load)
                    {
                        Plot();
                    }
                    break;

                case Selected.X:            // По оси времени
                {
                    if (DrawSer.Load)
                    {
                        wiCl -= (e.Location.X - scX);
                        if (wiCl > 50)
                        {
                            wiCl = 50;
                        }
                        else if (wiCl < 2)
                        {
                            wiCl = 2;
                        }
                        else
                        {
                            scX = e.Location.X;
                            PlotResize();
                        }
                    }
                }
                break;

                case Selected.Y:            // По оси цены
                {
                    if (DrawSer.Load)       //BarsDraw.Load)
                    {
                        hiCl -= (e.Location.Y - scY);
                        if (hiCl > 20)
                        {
                            hiCl = 20;
                        }
                        else if (hiCl < 2)
                        {
                            hiCl = 2;
                        }
                        else
                        {
                            scY = e.Location.Y;
                            PlotResize();
                        }
                    }
                }
                break;

                default:
                    break;
                }
            };
            #endregion
        }