Beispiel #1
0
 private Controller.Controller CreateController(string name, int status, Point location)
 {
     Controller.Controller controller = new Controller.Controller();
     controller.ControllerName = name;
     controller.Location       = location;
     if (status == 0)//关闭状态
     {
         controller.StateColor = Color.Red;
         controller.TextColor  = Color.Yellow;
     }
     else//打开状态
     {
         controller.StateColor = Color.Blue;
         controller.TextColor  = Color.Silver;
     }
     return(controller);
 }
Beispiel #2
0
        private void InitControllers()
        {
            //DataTable dt = DataAccess.dataTable("select Controller_Name,controller_id,serialNO,bondRode from controller_info  order by controller_id");
            DataTable dt    = DataAccess.dataTable("select Controller_Name,ID,serialNO,bondRode from controller_info  order by controller_id");
            int       count = dt.Rows.Count;

            controllerList = new Control[count];

            for (int k = 0; k < count; k++)
            {
                string name     = dt.Rows[k][0].ToString();
                int    j        = k % LINECOUNT;
                int    i        = k / LINECOUNT;
                Point  location = new Point(j * (WIDTH + MARGIN) + MARGIN, i * (HEIGHT + MARGIN) + MARGIN);
                Controller.Controller controller = CreateController(name, k % 2, location);
                controllerList[k] = controller;
            }
            this.groupBox1.Controls.AddRange(controllerList);
        }