Exemplo n.º 1
0
        void Form1_Shown(object sender, EventArgs e)
        {
            UDPServer.startUDPListening();

            //this.InitialClassRoom();
            this.InitializePanelControl();

            //饼图添加图例
            int initialTop = staticClass.getRealHeight(500);

            DataRow[] typeRows = MemoryTable.typeMapTable.Select();
            for (int i = 0; i < typeRows.Length; i++, initialTop = initialTop + staticClass.getRealHeight(45))
            {
                Button btnLegend = new Button();
                btnLegend.FlatStyle = FlatStyle.Flat;
                btnLegend.FlatAppearance.BorderSize = 0;
                btnLegend.Width     = staticClass.getRealWidth(70);
                btnLegend.Height    = staticClass.getRealHeight(23);
                btnLegend.BackColor = Color.FromArgb(alpha,
                                                     int.Parse(typeRows[i]["red"].ToString()),
                                                     int.Parse(typeRows[i]["green"].ToString()),
                                                     int.Parse(typeRows[i]["blue"].ToString()));
                btnLegend.Left = staticClass.getRealWidth(900);
                btnLegend.Top  = initialTop;
                this.Controls.Add(btnLegend);
                this.legendButtonList.Add(btnLegend);

                Label lblLegend = new Label();
                lblLegend.Left = staticClass.getRealWidth(990);
                lblLegend.Top  = initialTop + 8;
                //this.lblLocation.Location = new System.Drawing.Point(855, initialTop + 5);
                lblLegend.Text = (string)typeRows[i]["productName"];
                this.Controls.Add(lblLegend);
                this.legendLabelList.Add(lblLegend);
            }


            //在下拉列表中增加内容
            for (int i = 0; i < typeRows.Length; i++)
            {
                this.cmbProductName.Items.Add((string)typeRows[i]["productName"]);
            }

            _timer.Enabled = true;
        }
        void Form1_Shown(object sender, EventArgs e)
        {
            UDPServer.startUDPListening();

            this.InitialClassRoom();
            this.InitializePanelControl();

            //饼图添加图例
            int initialTop = 350;

            DataRow[] typeRows = MemoryTable.typeMapTable.Select();
            for (int i = 0; i < typeRows.Length; i++, initialTop = initialTop + 40)
            {
                Button btnLegend = new Button();
                btnLegend.FlatStyle = FlatStyle.Flat;
                btnLegend.FlatAppearance.BorderSize = 0;
                btnLegend.Width     = 61;
                btnLegend.Height    = 23;
                btnLegend.BackColor = Color.FromArgb(alpha, (int)typeRows[i]["red"], (int)typeRows[i]["green"], (int)typeRows[i]["blue"]);
                btnLegend.Left      = 780;
                btnLegend.Top       = initialTop;
                this.Controls.Add(btnLegend);
                this.legendButtonList.Add(btnLegend);

                Label lblLegend = new Label();
                lblLegend.Left = 855;
                lblLegend.Top  = initialTop + 5;
                lblLegend.Text = (string)typeRows[i]["productName"];
                this.Controls.Add(lblLegend);
                this.legendLabelList.Add(lblLegend);
            }


            //在下拉列表中增加内容
            for (int i = 0; i < typeRows.Length; i++)
            {
                this.cmbProductName.Items.Add((string)typeRows[i]["productName"]);
            }

            _timer.Enabled = true;
        }
 void frmRemind_Shown(object sender, EventArgs e)
 {
     UDPServer.startUDPListening();
     CreateGraph_Chart(this.zedGraphControl1);  //图表
     _timer.Enabled = true;
 }