Exemplo n.º 1
0
        private void MChart_MouseMove(object sender, MouseEventArgs e)
        {
            int x = e.X;
            int y = e.Y;

            if (this.MCMM_LastX == x && this.MCMM_LastY == y)
            {
                return;
            }

            this.MCMM_LastX = x;
            this.MCMM_LastY = y;

            try
            {
                double aX = this.MChart.ChartAreas[0].AxisX.PixelPositionToValue(x);
                double aY = this.MChart.ChartAreas[0].AxisY.PixelPositionToValue(y);

                long sec = this.LastStartWeSec + LongTools.toInt(aX * 86400.0);
                sec = WeSec.WeSecToSec(sec);
                long dateTime = DateTimeToSec.toDateTime(sec);

                this.TTip.SetToolTip(
                    this.MChart,
                    Utils.DateTimeToString(dateTime) + "\n" +
                    aY
                    );
            }
            catch
            { }
        }
Exemplo n.º 2
0
        private void DoAltCommand(string command, bool keepAxY = false)
        {
            try
            {
                string        args     = this.Args.Text;
                List <string> tokens   = StringTools.tokenize(args, ":");
                long          dateTime = long.Parse(tokens[1]);
                long          sec      = DateTimeToSec.toSec(dateTime);
                long          weSec    = WeSec.SecToWeSec(sec);

                switch (command)
                {
                case "戻る":
                {
                    long secBound = this.StringToSec(tokens[3]);

                    weSec -= secBound / 4;
                }
                break;

                case "進む":
                {
                    long secBound = this.StringToSec(tokens[3]);

                    weSec += secBound / 4;
                }
                break;

                case "Y-拡大":
                {
                    expandAxY(1.0 / 1.5);
                    keepAxY = true;
                }
                break;

                case "Y-縮小":
                {
                    expandAxY(1.5);
                    keepAxY = true;
                }
                break;

                case "拡大":
                {
                    long secInterval = this.StringToSec(tokens[2]);
                    long secBound    = this.StringToSec(tokens[3]);

                    secInterval /= 2;
                    secBound    /= 2;

                    // 調整 TODO
                    {
                        if (secBound % secInterval != 0)
                        {
                            secBound /= secInterval;
                            secBound *= secInterval;
                        }
                    }

                    tokens[2] = this.SecToString(secInterval);
                    tokens[3] = this.SecToString(secBound);
                }
                break;

                case "縮小":
                {
                    long secInterval = this.StringToSec(tokens[2]);
                    long secBound    = this.StringToSec(tokens[3]);

                    secInterval *= 2;
                    secBound    *= 2;

                    tokens[2] = this.SecToString(secInterval);
                    tokens[3] = this.SecToString(secBound);
                }
                break;

                default:
                    throw null;
                }

                sec            = WeSec.WeSecToSec(weSec);
                dateTime       = DateTimeToSec.toDateTime(sec);
                tokens[1]      = "" + dateTime;
                args           = string.Join(":", tokens);
                this.Args.Text = args;

                executeArgs(keepAxY);
            }
            catch
            { }
        }