예제 #1
0
        /// <summary>
        /// 初始化示波器
        /// </summary>
        private void InitWaveformMonitors()
        {
            if (m_aWaveformMonitors != null)
            {
                DisposeWaveformMonitors();
            }

            if (m_aWaveformMonitors == null)
            {
                // Let's disable SizeChanged event handler temporarily.
                // ArrangeMonitors method is called at the end of this
                // method.
                gridChart.SizeChanged -= gridChart_SizeChanged;

                m_aWaveformMonitors =
                    new WaveformMonitor(
                        gridChart,
                        _seriesNames,
                        _samplingFrequency,
                        DefaultColors.SeriesForBlackBackgroundWpf[0],
                        null);
                m_aWaveformMonitors.Chart.ChartName = "示波器";

                gridChart.SizeChanged += gridChart_SizeChanged;

                string strTitle = "示波器 (幅值 / 时间)\n"
                                  + " " + string.Format("采样频率 = {0} kHz",
                                                        ((double)+_samplingFrequency / 1000.0).ToString("0"));

                m_aWaveformMonitors.Initialize(_samplingFrequency, strTitle,
                                               XAxisScrollMode.Scrolling, 0.03125);
            }

            ArrangeMonitors();
        }
예제 #2
0
        /// <summary>
        /// 初始化示波器
        /// </summary>
        private void InitWaveformMonitors()
        {
            if (m_WaveformMonitor != null || m_CodeMonitor != null)
            {
                DisposeWaveformMonitors();
            }

            if (m_WaveformMonitor == null)
            {
                // Let's disable SizeChanged event handler temporarily.
                // ArrangeMonitors method is called at the end of this
                // method.
                gridChart.SizeChanged -= gridChart_SizeChanged;

                m_WaveformMonitor =
                    new WaveformMonitor(
                        gridChart,
                        _seriesNames,
                        _samplingFrequency,
                        DefaultColors.SeriesForBlackBackgroundWpf[0],
                        null);
                m_WaveformMonitor.Chart.ChartName = "示波器";

                gridChart.SizeChanged += gridChart_SizeChanged;

                string strTitle = "示波器 (幅值 / 时间)\n"
                                  + " " + string.Format("采样频率 = {0} kHz",
                                                        ((double)+_samplingFrequency / 1000.0).ToString("0"));

                m_WaveformMonitor.Initialize(_samplingFrequency, strTitle,
                                             XAxisScrollMode.Scrolling, 0.03125);

                m_WaveformMonitor.Chart.ViewXY.ZoomPanOptions.MouseWheelZooming = MouseWheelZooming.Off;
            }

            if (m_CodeMonitor == null)
            {
                // Let's disable SizeChanged event handler temporarily.
                // ArrangeMonitors method is called at the end of this
                // method.
                gridChart.SizeChanged -= gridChart_SizeChanged;

                m_CodeMonitor =
                    new WaveformMonitor(
                        gridChart,
                        new string[] {
                    "PCM编码"
                },
                        _samplingFrequency,
                        DefaultColors.SeriesForBlackBackgroundWpf[0],
                        null);
                m_CodeMonitor.Chart.ChartName = "PCM显示器";

                gridChart.SizeChanged += gridChart_SizeChanged;

                m_CodeMonitor.Initialize(_samplingFrequency, null,
                                         XAxisScrollMode.Scrolling, 0.03125);
                //重新设置Y轴范围
                m_CodeMonitor.Chart.ViewXY.YAxes.FirstOrDefault().SetRange(-0.5, 1.5);
                m_CodeMonitor.Chart.ViewXY.ZoomPanOptions.MouseWheelZooming = MouseWheelZooming.Off;
            }
            ArrangeMonitors();
        }