Ejemplo n.º 1
0
 private void 数据查询ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (myQueryForm != null)
     {
         myQueryForm.Activate();
     }
     else
     {
         myQueryForm = new 数据查询();
     }
     myQueryForm.ShowDialog();
 }
Ejemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            myQueryForm = new 数据查询();
            myMonitor   = new Monitor();
            XmlConfigurator.Configure();
            Type type  = MethodBase.GetCurrentMethod().DeclaringType;
            ILog m_log = LogManager.GetLogger(type);

            m_log.Debug("这是一个Debug日志");
            m_log.Info("这是一个Info日志");
            m_log.Warn("这是一个Warn日志");
            m_log.Error("这是一个Error日志");
            m_log.Fatal("这是一个Fatal日志");

            dt_AD.Columns.Add("序号", typeof(Int32));
            dt_AD.Columns.Add("名称", typeof(String));
            dt_AD.Columns.Add("测量值", typeof(double));
            dt_AD.Columns.Add("解析值", typeof(double));
            dt_AD.Columns.Add("单位", typeof(String));

            for (int i = 0; i < 19; i++)
            {
                DataRow dr = dt_AD.NewRow();
                dr["序号"]  = i + 1;
                dr["名称"]  = Function.GetConfigStr(Data.ADconfigPath, "add", "AD_Channel_" + i.ToString(), "name");
                dr["测量值"] = 0;
                dr["解析值"] = 0;
                dr["单位"]  = Function.GetConfigStr(Data.ADconfigPath, "add", "AD_Channel_" + i.ToString(), "dw");
                dt_AD.Rows.Add(dr);
            }

            dataGridView1.DataSource         = dt_AD;
            dataGridView1.AllowUserToAddRows = false;

            SetDevice(false);

            Data.MyPane = zedGraphControl1.GraphPane;

            Data.MyPane.Title.Text = "AD显示表";

            Data.MyPane.XAxis.Title.Text = "时间";

            Data.MyPane.YAxis.Title.Text = "AD1";
            //      Data.MyPane.YAxis.Title.FontSpec.Size = 8;
            Data.MyPane.YAxis.Title.IsVisible = false;

            Data.MyPane.Legend.Position      = LegendPos.TopFlushLeft;
            Data.MyPane.Legend.FontSpec.Size = 8;



            double[] x = new double[100];
            double[] y = new double[100];
            for (int i = 0; i < 1; i++)
            {
                x[i] = 0;
                y[i] = 0;
            }

            if (Data.MyPane.CurveList != null)
            {
                Data.MyPane.CurveList.Clear();
            }

            LineItem myCurve = Data.MyPane.AddCurve("AD1", x, y, Color.Red, SymbolType.Square);

            //   myCurve.Symbol.Fill = new Fill(Color.White);

            myCurve = Data.MyPane.AddCurve("AD2", x, y, Color.Gold, SymbolType.Square);
            //  myCurve.Symbol.Fill = new Fill(Color.White);
            //    myCurve.YAxisIndex = 1;

            myCurve = Data.MyPane.AddCurve("AD3", x, y, Color.Green, SymbolType.Square);
            //    myCurve.Symbol.Fill = new Fill(Color.White);
            //    myCurve.YAxisIndex = 3;

            Data.MyPane.AddCurve("AD4", x, y, Color.Blue, SymbolType.Square);
            // myCurve.Symbol.Fill = new Fill(Color.White);
            //  myCurve.YAxisIndex = 2;


            Data.MyPane.AddCurve("AD5", x, y, Color.Red, SymbolType.Square);
            Data.MyPane.AddCurve("AD6", x, y, Color.Gold, SymbolType.Square);
            Data.MyPane.AddCurve("AD7", x, y, Color.Green, SymbolType.Square);
            Data.MyPane.AddCurve("AD8", x, y, Color.Blue, SymbolType.Square);
            Data.MyPane.AddCurve("AD9", x, y, Color.Red, SymbolType.Square);
            Data.MyPane.AddCurve("AD10", x, y, Color.Gold, SymbolType.Square);
            Data.MyPane.AddCurve("AD11", x, y, Color.Green, SymbolType.Square);
            Data.MyPane.AddCurve("AD12", x, y, Color.Blue, SymbolType.Square);
            Data.MyPane.AddCurve("AD13", x, y, Color.Red, SymbolType.Square);
            Data.MyPane.AddCurve("AD14", x, y, Color.Gold, SymbolType.Square);
            Data.MyPane.AddCurve("AD15", x, y, Color.Green, SymbolType.Square);
            Data.MyPane.AddCurve("AD16", x, y, Color.Blue, SymbolType.Square);
        }