mySpectrumScope2.Channels.AddRange(new Mitov.PlotLab.ScopeChannel[] {//把值传到mySpectrumScope2中//
            scopeChannel21,
            scopeChannel22,
            scopeChannel23});
            mySpectrumScope2.Channels[0].Data.AddYData(spect_array01, 0, 600);
            mySpectrumScope2.XAxis.AdditionalAxes[0].Axis.Visible = true;
            mySpectrumScope2.XAxis.AdditionalAxes[1].Axis.Visible = false;
            mySpectrumScope2.XAxis.AdditionalAxes[0].Axis.Min.Value = 942 -  20.0;
            mySpectrumScope2.XAxis.AdditionalAxes[0].Axis.Max.Value = 942 +  20.0;            mySpectrumScope3.Location = new Point(0, 0);//设置第二张频谱图的相关位置
            mySpectrumScope3.Size = new System.Drawing.Size(xArrayPoint/2, yArrayPoint);
            mySpectrumScope3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            mySpectrumScope3.Title.Visible = true;
            mySpectrumScope3.Title.Font.Size = 9;
            mySpectrumScope3.Title.ViewSize.AutoSize = true;
            mySpectrumScope3.Dock = System.Windows.Forms.DockStyle.Fill;
            mySpectrumScope3.XAxis.AxisLabel.Visible = false;
            mySpectrumScope3.Title.Text = "频谱(MHz)";
            mySpectrumScope3.XAxis.Max.DataValue = 600;
            mySpectrumScope3.XAxis.Max.Value = 600;
            mySpectrumScope3.YAxis.Max.DataValue = 0;
            mySpectrumScope3.YAxis.Max.Value = 0;
            mySpectrumScope3.YAxis.Min.DataValue = -100;
            mySpectrumScope3.YAxis.Min.Value = -100;
            mySpectrumScope3.YAxis.AutoScaling.Enabled = false;
            mySpectrumScope3.YAxis.AxisLabel.Text = "功率(dBm)";
            mySpectrumScope3.YAxis.AxisLabel.Font.Size = 9;            //第二张图的传值程序            mySpectrumScope3.Channels.AddRange(new Mitov.PlotLab.ScopeChannel[] {//把值传到mySpectrumScope3中//
            scopeChannel21,
            scopeChannel22,
            scopeChannel23});
            mySpectrumScope3.Channels[0].Data.AddYData(spect_array01, 0, 600);
            mySpectrumScope3.XAxis.AdditionalAxes[0].Axis.Visible = true;
            mySpectrumScope3.XAxis.AdditionalAxes[1].Axis.Visible = false;
            mySpectrumScope3.XAxis.AdditionalAxes[0].Axis.Min.Value = 942 - 20.0;
            mySpectrumScope3.XAxis.AdditionalAxes[0].Axis.Max.Value = 942 + 20.0;
            mySpectrumScope4.Location = new Point(50, 60);//设置Scope4 子控件的位置
            mySpectrumScope4.Size = new System.Drawing.Size(420, 200);//设置子控件的高度和宽度
            mySpectrumScope4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));//子控件的颜色
            myStarScope1.Location = new Point(500, 60);//设置Scope1 子控件的位置
            myStarScope1.Size = new System.Drawing.Size(420, 400);//设置子控件的高度和宽度
            myStarScope1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));//子控件的颜色
            this.Focus();            toolStripButton2.Enabled = false;
            toolStripButton3.Enabled = false;
            toolStripButton4.Enabled = false;
            toolStripButton5.Enabled = false;
            toolStripButton6.Enabled = false;
            toolStripButton7.Enabled = false;
            toolStripButton8.Enabled = false;
            toolStripButton1.Enabled = false;
            toolStripButton9.Enabled = false;
            toolStripButton10.Enabled = false;
            toolStripButton11.Enabled = false;
            toolStripButton12.Enabled = false;
            toolStripButton13.Enabled = false;
            toolStripButton14.Enabled = false;
        }
        public void chart_refresh()//刷新
        {
            mySpectrumScope2.Channels[0].Data.Clear();
            mySpectrumScope2.Channels[0].Data.AddYData(spect_array01, 0, 600);
        }
        private void ScanWork()//扫描
        {
            double dtemp;
            while (true)
            {
                dtemp = spect_array01[0];
                for (int i = 0; i < 599; i++) spect_array01[i] = spect_array01[i + 1];
                spect_array01[599] = dtemp;
                Thread.Sleep(25);
                this.Invoke(updateUI8);
                //mySpectrumScope2.Channels[0].Data.Clear();
                //mySpectrumScope2.Channels[0].Data.AddYData(spect_array01, 0, 600);
            }
        }
        private void timer1_Tick(object sender, EventArgs e)//时钟//
        {
            double[] Buffer1 = new double[1000];
            double[] Buffer2 = new double[1000];
            for (int i = 0; i < 1000; i++)
            {
                Buffer1[i] = m_RandomGen.NextDouble() * 40000 - 20000;
                Buffer2[i] = (m_Counter % 120) * 300 - 18000;
                m_Counter++;
            }
        }
        
        private Random m_RandomGen = new Random(123);
        private int m_Counter = 0;
       
        /*
        private void toolStripButton1_Click(object sender, EventArgs e)
        {            if (formMainScan == null || formMainScan.IsDisposed)
            {
                formMainScan = new Form3();
                formMainScan.Text = "射频全景频谱";
                formMainScan.MdiParent = this;
                //formMainScan.Size = new System.Drawing.Size(xArrayPoint+10, yArrayPoint * 2 + 30);
                formMainScan.mySpectrumScope = mySpectrumScope1;
                formMainScan.myWaterfall = myWaterfall1;
                formMainScan.Form_add();
                formMainScan.Show();
                
            }            else { formMainScan.Activate(); } 
        }*/        private void toolStripButton2_Click(object sender, EventArgs e)//射频一button//
        {
            if (formS1Scan == null || formS1Scan.IsDisposed)
            {                formS1Scan = new Form2();//实例化一个form2的对象//
                formS1Scan.Text = "射频观测频段一";
                formS1Scan.MdiParent = this;
                //formS1Scan.Size = new System.Drawing.Size(xArrayPoint/2+5, yArrayPoint * 2);
                formS1Scan.mySpectrumScope = mySpectrumScope2;
                //formS1Scan.myWaterfall = myWaterfall2;
                formS1Scan.Form_add();
                formS1Scan.Show();
            }            else { formS1Scan.Activate(); } 
            
                    }        private void toolStripButton3_Click(object sender, EventArgs e)//射频二button//
        {
            if (formS2Scan == null || formS2Scan.IsDisposed)
            {                formS2Scan = new Form2();
                formS2Scan.Text = "射频观测频段二";
                formS2Scan.MdiParent = this;
                //formS2Scan.Size = new System.Drawing.Size(xArrayPoint/2+5, yArrayPoint * 2);
                formS2Scan.mySpectrumScope = mySpectrumScope3;
                //formS2Scan.myWaterfall = myWaterfall3;
                formS2Scan.Form_add();
                formS2Scan.Show();//频谱显示
            }            else { formS2Scan.Activate(); } 
        }        private void toolStripButton4_Click(object sender, EventArgs e)//信号检测列表button//
        {
            //this.LayoutMdi(MdiLayout.Cascade);
            if (formListSignal == null || formListSignal.IsDisposed)
            {                formListSignal = new Form4();
                formListSignal.Text = "信号检测列表";
                formListSignal.MdiParent = this;
                //formS1Scan.Size = new System.Drawing.Size(xArrayPoint/2+5, yArrayPoint * 2);                formListSignal.SignalList = SignalList;
                formListSignal.Form_add();
                formListSignal.Show();            }            else { formListSignal.Activate(); }         }        private void toolStripButton5_Click(object sender, EventArgs e)//设备状态button//
        {
            if (formstatus == null || formstatus.IsDisposed)
            {                formstatus = new Form6();
                formstatus.Text = "设备状态";
                formstatus.MdiParent = this;
                formstatus.Show();            }
            else { formstatus.Activate(); } 
        }

解决方案 »

  1.   

      private void toolStripButton6_Click(object sender, EventArgs e)//平铺//
            {
                //this.LayoutMdi(MdiLayout.TileVertical);
                /*
                formMainScan.WindowState = FormWindowState.Normal;
                formS1Scan.WindowState = FormWindowState.Normal;
                formS2Scan.WindowState = FormWindowState.Normal;
                formMainScan.Location = new Point(0, 0);
                formS2Scan.Location = new Point(0, 320);
                formS1Scan.Location = new Point(635, 320);*/
                //if (formMainScan   != null) formMainScan.WindowState = FormWindowState.Normal;
                if (formS1Scan     != null) formS1Scan.WindowState = FormWindowState.Normal;
                if (formS2Scan     != null) formS2Scan.WindowState = FormWindowState.Normal;
                if (formListSignal != null) formListSignal.WindowState = FormWindowState.Normal;
                if (formstatus != null) formstatus.WindowState = FormWindowState.Normal;            if (formListSignal != null) formListSignal.Location = new Point(0, 0);
                //if (formMainScan   != null) formMainScan.Location = new Point(0, 140);
                if (formS1Scan     != null) formS2Scan.Location = new Point(0, 430);
                if (formS2Scan     != null) formS1Scan.Location = new Point(635, 430);
                if (formstatus != null) formstatus.Location = new Point(800,0);
                //if (formMainScan != null) formMainScan.Focus();
                if (formListSignal != null) formListSignal.Focus();
                if (formstatus != null) formstatus.Focus();
                
            }        private void toolStripButton7_Click(object sender, EventArgs e)
            {
                //this.LayoutMdi(MdiLayout.ArrangeIcons);
                //if (formMainScan != null) formMainScan.WindowState = FormWindowState.Normal;
                if (formS1Scan != null) formS1Scan.WindowState = FormWindowState.Normal;
                if (formS2Scan != null) formS2Scan.WindowState = FormWindowState.Normal;
                if (formListSignal != null) formListSignal.WindowState = FormWindowState.Normal;
                if (formstatus != null) formstatus.WindowState = FormWindowState.Normal;
                //if (formMainScan != null) formMainScan.Location = new Point(0, 0);
                if (formS1Scan != null) formS1Scan.Location = new Point(25, 25);
                if (formS2Scan != null) formS2Scan.Location = new Point(50, 50);
                if (formListSignal != null) formListSignal.Location = new Point(75, 75);
                if (formstatus != null) formstatus.Location = new Point(100, 100);
                if (formS1Scan != null) formS1Scan.Focus();
                if (formS2Scan != null) formS2Scan.Focus();
                if (formListSignal != null) formListSignal.Focus();
                if (formstatus != null) formstatus.Focus();
            }        private void Form1_Load(object sender, EventArgs e)
            {        }
            protected override void OnFormClosing(FormClosingEventArgs e)
            {
                /*
                if (MessageBox.Show(
                "你确认要退出该程序吗?",
                 "提示", MessageBoxButtons.YesNo,
                MessageBoxIcon.Question,
                MessageBoxDefaultButton.Button2) ==
                DialogResult.Yes)                base.OnFormClosing(e);            else                e.Cancel = true;
                */
            }        private void toolStripButton8_Click(object sender, EventArgs e)
            {
                //this.LayoutMdi(MdiLayout.TileHorizontal);
                //if (formMainScan != null) formMainScan.WindowState = FormWindowState.Minimized;
                if (formS1Scan != null) formS1Scan.WindowState = FormWindowState.Minimized;
                if (formS2Scan != null) formS2Scan.WindowState = FormWindowState.Minimized;
                if (formListSignal != null) formListSignal.WindowState = FormWindowState.Minimized;
                if (formstatus != null) formstatus.WindowState = FormWindowState.Minimized;
            }        private void modeScan_Click(object sender, EventArgs e)//扫描侦查//
            {
                modeScan.Checked = true;//对按键进行设置//
                modeFixed.Checked = false;
                toolStripButton2.Enabled = true;
                toolStripButton3.Enabled = true;
                toolStripButton4.Enabled = true;
                toolStripButton5.Enabled = true;
                toolStripButton6.Enabled = true;
                toolStripButton7.Enabled = true;
                toolStripButton8.Enabled = true;
                toolStripButton1.Enabled = false;
                toolStripButton9.Enabled = false;
                toolStripButton10.Enabled = false;
                toolStripButton11.Enabled = false;
                toolStripButton12.Enabled = false;
                toolStripButton13.Enabled = false;
                toolStripButton14.Enabled = false;
                if (formfixed != null) formfixed.Close();
                if (formtype5 != null) formtype5.Close();
                if (formListSignal != null) formListSignal.Close();
                if (formstatus != null) formstatus.Close();
                if (ScanThread == null)
                {
                    ScanThread = new Thread(new ThreadStart(ScanWork));
                    ScanThread.Name = "ScanThread";
                    ScanThread.IsBackground = true;
                    ScanThread.Start();
                }        }        private void modeFixed_Click(object sender, EventArgs e)//实时监测//
            {
                ScanThread.Abort();
                ScanThread.Join();
                ScanThread = null;
                modeScan.Checked = false;
                modeFixed.Checked = true;//对按键进行设置// 
                toolStripButton2.Enabled = false;
                toolStripButton3.Enabled = false;
                toolStripButton4.Enabled = false;
                toolStripButton5.Enabled = false;
                toolStripButton6.Enabled = false;
                toolStripButton7.Enabled = false;
                toolStripButton8.Enabled = false;
                toolStripButton1.Enabled = true;
                toolStripButton9.Enabled = true;
                toolStripButton10.Enabled = true;
                toolStripButton11.Enabled = true;
                toolStripButton12.Enabled = true;
                toolStripButton13.Enabled = true;
                toolStripButton14.Enabled = true;
                //if (formMainScan != null) formMainScan.Close();
                if (formS1Scan != null) formS1Scan.Close();
                if (formS2Scan != null) formS2Scan.Close();
                if (formListSignal != null) formListSignal.Close();
                if (formstatus != null) formstatus.Close();        }
      

  2.   

      private void toolStripButton10_Click(object sender, EventArgs e)
            {
                if (formtype5 == null || formtype5.IsDisposed)
                {
                    formtype5 = new Form5();
                    formtype5.Text = "星座图";
                    formtype5.MdiParent = this;
                    formtype5.Show();
                }            else { formtype5.Activate(); } 
            }        private void toolStripButton9_Click(object sender, EventArgs e)
            {
                if (formfixed == null || formfixed.IsDisposed)
                {                formfixed = new Form2();
                    formfixed.Text = "定频侦测频谱";
                    formfixed.MdiParent = this;
                    //formS2Scan.Size = new System.Drawing.Size(xArrayPoint/2+5, yArrayPoint * 2);
                    formfixed.mySpectrumScope = mySpectrumScope3;
                    formfixed.Form_add();
                    formfixed.Show();
                }            else { formfixed.Activate(); } 
            }        private void toolStripButton12_Click(object sender, EventArgs e)
            {
                if (formListSignal == null || formListSignal.IsDisposed)
                {                formListSignal = new Form4();
                    formListSignal.Text = "信号检测列表";
                    formListSignal.MdiParent = this;
                    //formS1Scan.Size = new System.Drawing.Size(xArrayPoint/2+5, yArrayPoint * 2);                formListSignal.SignalList = SignalList;
                    formListSignal.Form_add();
                    formListSignal.Show();            }            else { formListSignal.Activate(); } 
            }        private void toolStripButton13_Click(object sender, EventArgs e)
            {
                if (formstatus == null || formstatus.IsDisposed)
                {                formstatus = new Form6();
                    formstatus.Text = "设备状态";
                    formstatus.MdiParent = this;
                    formstatus.Show();            }
                else { formstatus.Activate(); } 
            }        private void 参数设置ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                Form parameterSetting = new Form();
                parameterSetting.Text = "参数设置";
                parameterSetting.MdiParent = this;
                parameterSetting.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
                parameterSetting.MinimizeBox = true;
                parameterSetting.Show();
            }
        }    public class mySpectrumPlot : FlowLayoutPanel
        {
            public Mitov.PlotLab.Scope mySpectrumScope = null;
            public Mitov.PlotLab.Waterfall myWaterfall = null;        public mySpectrumPlot()
            {        }
        }
    }