Exemplo n.º 1
0
 private void Set_Page(int page)
 {
     for (int i = 0; i < allsubview.Count; i++)
     {
         SubView subview = (SubView)allsubview[i];
         subview.Set_Machine_Num((page - 1) * 16 + i + 1);
     }
 }
Exemplo n.º 2
0
        public static bool[] chuanganqi_connect_is = new bool[400];              // 传感器是否连接上


        public Form1()
        {
            InitializeComponent();
            ViewCaoZuo.Max_Form(this);
            ViewCaoZuo.Object_Position(0.94, 0.05, 0.05, 0.04, button_exit, this.Controls);
            ViewCaoZuo.Object_Position(0.94, 0.10, 0.05, 0.04, button1, this.Controls);
            ViewCaoZuo.Object_Position(0.94, 0.15, 0.05, 0.04, button2, this.Controls);
            ViewCaoZuo.Object_Position(0.94, 0.20, 0.05, 0.04, button3, this.Controls);
            ViewCaoZuo.Object_Position(0.94, 0.25, 0.05, 0.04, button4, this.Controls);



            // 换页

            allsubview.Clear();
            for (int i = 1; i <= 16; i++)
            {
                SubView subview = new SubView();
                subview.Set_Machine_Num(i);
                ViewCaoZuo.Object_Position(0.01 + (i - 1) % 4 * 0.2, 0.05 + (i - 1) / 4 * 0.2, 0.19, 0.19, subview, this.Controls);
                allsubview.Add(subview);
            }

            /// 建立数个ip客户端,用以连接
            ///
            for (int i = 1; i < 100; i++)
            {
                try
                {
                    string          address_string = SubView.inifile.IniReadValue("station_ip", i.ToString());
                    IPAddress       ip             = IPAddress.Parse(address_string);
                    TcpServerClient client         = new TcpServerClient(address_string, 8880);
                    allclient.Add(client);
                    client.Data_Arrival_Event += new EventHandler(DataArrival);
                }
                catch { }
            }
        }