关于plotlab的图形控件。实现一些基础功能
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
delegate void UpdateUICallback8();
UpdateUICallback8 updateUI8;
Thread ScanThread = null;
const int xArrayPoint = 1260;//X轴//
const int yArrayPoint = 150; //Y轴//
Mitov.PlotLab.Scope mySpectrumScope1 = new Mitov.PlotLab.Scope();//第一条线// 在c#中每次使用新的功能都要进行创建新实例
Mitov.PlotLab.Scope mySpectrumScope2 = new Mitov.PlotLab.Scope();
Mitov.PlotLab.ScopeChannel scopeChannel21 = new Mitov.PlotLab.ScopeChannel();
Mitov.PlotLab.ScopePoints scopePoints21 = new Mitov.PlotLab.ScopePoints();
Vcl.VclPen vclPen21 = new Vcl.VclPen();
Mitov.PlotLab.ScopeChannel scopeChannel22 = new Mitov.PlotLab.ScopeChannel();//第二条线//
Mitov.PlotLab.ScopePoints scopePoints22 = new Mitov.PlotLab.ScopePoints();
Vcl.VclPen vclPen22 = new Vcl.VclPen();
Mitov.PlotLab.ScopeChannel scopeChannel23 = new Mitov.PlotLab.ScopeChannel();//第三条线//
Mitov.PlotLab.ScopePoints scopePoints23 = new Mitov.PlotLab.ScopePoints();
Vcl.VclPen vclPen23 = new Vcl.VclPen();
Mitov.PlotLab.Scope mySpectrumScope3 = new Mitov.PlotLab.Scope();
Mitov.PlotLab.Scope mySpectrumScope4 = new Mitov.PlotLab.Scope();
Mitov.PlotLab.Scope myStarScope1 = new Mitov.PlotLab.Scope();
double[] spect_array01 = new double[1024];
double[] spect_array02 = new double[1024];
double[] spect_array03 = new double[1024];
double[] wave_array = new double[1024];
private static Form2 formS1Scan;//定义formS1Scan可以调用Form2中的所有方法
private static Form2 formS2Scan;
private static Form4 formListSignal;
private static Form2 formfixed;
private static Form5 formtype5;
private static Form6 formstatus;
private static System.Windows.Forms.TabControl SignalList;
private TabPage tabPage01;
private TabPage tabPage02;
private TabPage tabPage03;
private TabPage tabPage04;
private TabPage tabPage05;
private Random a_RandomGen = new Random(123);
private int Counter2 = 0;
public Form1()
{
InitializeComponent();
updateUI8 = new UpdateUICallback8(chart_refresh);//模拟信号button//
/* for (int i = 0; i < 600; i++) spect_array01[i] = -70;
for (int i = 34; i < 39; i++) spect_array01[i] = -10;*/
for (int i = 0; i < 100; i++)
{
spect_array01[i] = a_RandomGen.NextDouble() * 200 - 100; //频谱
spect_array02[i] = ( Counter2 % 15 - 7) * 10; //一个周期15振幅为7//波形
Counter2 ++;
}
SignalList = new TabControl();
SignalList.Location = new Point(0,0);
SignalList.Size = new System.Drawing.Size(800, 150);//显示频谱窗口的大小button//
tabPage01 = new System.Windows.Forms.TabPage();
SignalList.Controls.Add(tabPage01);
tabPage01.UseVisualStyleBackColor = true;
tabPage01.Text = "当前信号";
tabPage02 = new System.Windows.Forms.TabPage();
SignalList.Controls.Add(tabPage02);
tabPage02.UseVisualStyleBackColor = true;
tabPage02.Text = "历史信号";
tabPage03 = new System.Windows.Forms.TabPage();
SignalList.Controls.Add(tabPage03);
tabPage03.UseVisualStyleBackColor = true;
tabPage03.Text = "新发现信号";
tabPage04 = new System.Windows.Forms.TabPage();
SignalList.Controls.Add(tabPage04);
tabPage04.UseVisualStyleBackColor = true;
tabPage04.Text = "重要信号";
tabPage05 = new System.Windows.Forms.TabPage();
SignalList.Controls.Add(tabPage05);
tabPage05.UseVisualStyleBackColor = true;
tabPage05.Text = "一般信号";
//mySpectrumScope1.Location = new Point(5, 60);
mySpectrumScope1.Location = new Point(0, 0);//xy初始坐标
mySpectrumScope1.Size = new System.Drawing.Size(xArrayPoint, yArrayPoint);
mySpectrumScope1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
mySpectrumScope1.Title.Visible = true;
mySpectrumScope1.Title.Font.Size = 9;
mySpectrumScope1.Title.ViewSize.AutoSize = true;
mySpectrumScope1.Dock = System.Windows.Forms.DockStyle.Fill;//第一张频谱图停靠的位置 铺满
mySpectrumScope1.XAxis.AxisLabel.Visible = false;
mySpectrumScope1.Title.Text = "频谱(MHz)";
mySpectrumScope1.XAxis.Max.DataValue = 600;//频谱图的600个点
mySpectrumScope1.XAxis.Max.Value = 600;
mySpectrumScope1.YAxis.Max.DataValue = 0;
mySpectrumScope1.YAxis.Max.Value = 0;
mySpectrumScope1.YAxis.Min.DataValue = -100;
mySpectrumScope1.YAxis.Min.Value = -100;
mySpectrumScope1.YAxis.AutoScaling.Enabled = false;
mySpectrumScope1.YAxis.AxisLabel.Text = "功率(dBm)";
mySpectrumScope1.YAxis.AxisLabel.Font.Size = 9;
// scope2 for wideband spectrum
mySpectrumScope2.Location = new Point(0, 0);//频谱图窗体的定义//
mySpectrumScope2.Size = new System.Drawing.Size(xArrayPoint/2, yArrayPoint);
mySpectrumScope2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
mySpectrumScope2.Title.Visible = true;
mySpectrumScope2.Title.Font.Size = 9;
mySpectrumScope2.Title.ViewSize.AutoSize = true;
mySpectrumScope2.Dock = System.Windows.Forms.DockStyle.Fill;//设置控件的边框停靠父控件的位置 平铺
mySpectrumScope2.XAxis.AxisLabel.Visible = true;//????
mySpectrumScope2.Title.Text = "频谱";
mySpectrumScope2.XAxis.Max.DataValue = 600;
mySpectrumScope2.XAxis.Max.Value = 600;
mySpectrumScope2.XAxis.Min.DataValue = 0;
mySpectrumScope2.XAxis.Min.Value = 0;
mySpectrumScope2.XAxis.AxisLabel.Text = "频率(dBm)";
mySpectrumScope2.XAxis.AxisLabel.Font.Size = 9;
mySpectrumScope2.YAxis.Max.DataValue = 0;
mySpectrumScope2.YAxis.Max.Value = 0;
mySpectrumScope2.YAxis.Min.DataValue = -100;
mySpectrumScope2.YAxis.Min.Value = -100;
mySpectrumScope2.YAxis.AutoScaling.Enabled = false;
mySpectrumScope2.YAxis.AxisLabel.Text = "功率(dBm)";
mySpectrumScope2.YAxis.AxisLabel.Font.Size = 9;
scopeChannel21.Color = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
//scopeChannel21.InternalData = ((Vcl.VclBinaryData)(resources.GetObject("scopeChannel4.InternalData")));
scopeChannel21.MouseCursor = System.Windows.Forms.Cursors.Default;
scopeChannel21.Name = "频谱";
scopePoints21.Brush = new Vcl.VclBrush(System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))), 0);
vclPen21.Color = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
//vclPen20.InternalData = ((Vcl.VclBinaryData)(resources.GetObject("vclPen20.InternalData")));
scopePoints21.Pen = vclPen21;
scopePoints21.Size = ((uint)(3u));
scopeChannel21.Points = scopePoints21;
scopeChannel21.XAxisIndex = 0;
scopeChannel21.YAxisIndex = 0;
scopeChannel22.Color = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
//scopeChannel22.InternalData = ((Vcl.VclBinaryData)(resources.GetObject("scopeChannel5.InternalData")));
scopeChannel22.MouseCursor = System.Windows.Forms.Cursors.Default;
scopeChannel22.Name = "迹线";
scopePoints22.Brush = new Vcl.VclBrush(System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))), 0);
vclPen22.Color = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
//vclPen22.InternalData = ((Vcl.VclBinaryData)(resources.GetObject("vclPen21.InternalData")));
scopePoints22.Pen = vclPen22;
scopePoints22.Size = ((uint)(3u));
scopeChannel22.Points = scopePoints22;
scopeChannel22.XAxisIndex = 0;
scopeChannel22.YAxisIndex = 0;
scopeChannel23.Color = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
//scopeChannel23.InternalData = ((Vcl.VclBinaryData)(resources.GetObject("scopeChannel6.InternalData")));
scopeChannel23.MouseCursor = System.Windows.Forms.Cursors.Default;
scopeChannel23.Name = "波形";
scopePoints23.Brush = new Vcl.VclBrush(System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))), 0);
vclPen23.Color = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
//vclPen23.InternalData = ((Vcl.VclBinaryData)(resources.GetObject("vclPen22.InternalData")));
scopePoints23.Pen = vclPen22;
scopePoints23.Size = ((uint)(3u));
scopeChannel23.Points = scopePoints23;
scopeChannel23.XAxisIndex = 0;
scopeChannel23.YAxisIndex = 0;