示例#1
0
        private void ChangeUseMatchTime(bool use, bool force = false)
        {
            if (use != UseMatchTime)
            {
                UseMatchTime = use;
                EventsView.AddEvents();
            }

            UseMatchTime = use;

            if (!CanUseMatchTime)
            {
                UseMatchTime = false;
                buttonMatchTime.BackColor = SystemColors.ControlDark;
                chart.ChartAreas[0].AxisX.CustomLabels.Clear();
            }
            else if (UseMatchTime)
            {
                buttonMatchTime.BackColor = Color.Lime;
                ChangeChartLabels(force);
            }
            else
            {
                buttonMatchTime.BackColor = Color.Red;
                chart.ChartAreas[0].AxisX.CustomLabels.Clear();
            }
        }
示例#2
0
        private void Chart_MouseMove(object sender, MouseEventArgs e)
        {
            if (PlottingLog || LoadingLog)
            {
                return;
            }
            var pos = e.Location;

            if (prevPosition.HasValue && pos == prevPosition.Value)
            {
                return;
            }
            prevPosition = pos;
            var results = chart.HitTest(pos.X, pos.Y, false, ChartElementType.DataPoint);

            foreach (var result in results)
            {
                if (result.ChartElementType == ChartElementType.DataPoint)
                {
                    var prop = result.Object as DataPoint;
                    if (prop != null)
                    {
                        if (prop.YValues[0] == 15 || prop.YValues[0] == 14.7)
                        {
                            var pointXPixel = result.ChartArea.AxisX.ValueToPixelPosition(prop.XValue);
                            var pointYPixel = result.ChartArea.AxisY.ValueToPixelPosition(prop.YValues[0]);

                            // check if the cursor is really close to the point (25 pixels around the point)
                            if (Math.Abs(pos.X - pointXPixel) < 25 &&
                                Math.Abs(pos.Y - pointYPixel) < 25)
                            {
                                string data = "";
                                if (EventsView.TryGetEvent(prop.XValue, out data))
                                {
                                    MForm.SetGraphRichText(data, Util.MessageColor(data));
                                }
                                else
                                {
                                    MForm.SetGraphRichText("", SystemColors.Window);
                                }
                            }
                        }
                    }
                }
            }
        }