Example #1
0
 public FormControl()
 {
     InitializeComponent();
     CheckForIllegalCrossThreadCalls = false;
     _DataControl = new DataControl();
     _DataControl.CreateService();                        //必须调用
     _DataControl.GetService().EnableAutoReConnect(true); //使能断线重连
     _FormControl        = this;
     opcServer           = new OpcServer(_LstEnumInfo);
     FormMain.OnDestroy += new FormMain.delegateDestroy(OnDestroy);
     AsyncConnectionPlc();//创建服务
     FormMain.GetOPCTaskInfo("与PLC建立连接中!");
     ChangeBtnCursor(1);
     CreateThread();
 }
Example #2
0
        void InitializeAllWindows()
        {
            //主窗口
            this.Width  = (int)MAINWINDOW_WIDTH;
            this.Height = (int)MAINWINDOW_HEIGHT;

            //控制窗口
            _FormControl                 = new FormControl();
            _FormControl.TopLevel        = false;
            _FormControl.Parent          = this;
            _FormControl.FormBorderStyle = FormBorderStyle.Fixed3D;
            _FormControl.ControlBox      = false;
            _FormControl.Left            = (int)(MAINWINDOW_WIDTH - CONTROLWINDOW_WIDTH);
            _FormControl.Top             = 0;
            _FormControl.Width           = (int)CONTROLWINDOW_WIDTH;
            _FormControl.Height          = (int)(CONTROLWINDOW_HEIGHT);
            _FormControl.Show();

            //显示窗口的背景窗口
            _FormDisplayBG                 = new FormDisplayBG();
            _FormDisplayBG.TopLevel        = false;
            _FormDisplayBG.Parent          = this;
            _FormDisplayBG.FormBorderStyle = FormBorderStyle.None;
            _FormDisplayBG.TopLevel        = false;
            _FormDisplayBG.Hide();

            //显示窗口
            _FormDisplayLst = new FormDisplay[MAX_DEVWINDOW_NUM];
            for (uint i = 0; i < MAX_DEVWINDOW_NUM; i++)
            {
                _FormDisplayLst[i]                 = new FormDisplay();
                _FormDisplayLst[i].TopLevel        = false;
                _FormDisplayLst[i].Parent          = _FormDisplayBG;
                _FormDisplayLst[i].FormBorderStyle = FormBorderStyle.None;
                _FormDisplayLst[i].Hide();
                _FormDisplayLst[i].GetDateDisplay().WndIndex = i;
            }
        }
Example #3
0
        // Label lblErrInfo = new Label();
        void InitializeAllWindows()
        {
            //this.label2.AutoSize = true;
            //this.label2.Font = new System.Drawing.Font("微软雅黑", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            //this.label2.Location = new System.Drawing.Point(15, 71);
            //this.label2.Name = "label2";
            //this.label2.Size = new System.Drawing.Size(21, 20);
            //this.label2.TabIndex = 1;
            //this.label2.Text = "y:";
            FormPwd = new FormPwd();
            //主窗口
            this.Width  = (int)MAINWINDOW_WIDTH;
            this.Height = (int)MAINWINDOW_HEIGHT;
            this.Controls.Add(this.list_data);
            this.list_data.Dock = DockStyle.Bottom;
            this.list_data.FormattingEnabled = true;
            this.list_data.ItemHeight        = 12;
            this.list_data.Location          = new System.Drawing.Point(0, 0);
            this.list_data.Name = "list_data";
            handle += upDateList;
            this.list_data.TabIndex = 40;
            //lblErrInfo.Location = new Point(0, list_data.Height );
            //lblErrInfo.Text = "错误信息";
            //lblErrInfo.Font = new System.Drawing.Font("微软雅黑", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            //lblErrInfo.Size = new Size(21, 20);
            //list_data.Controls.Add(lblErrInfo);

            //控制窗口
            _FormControl = new FormControl();

            _FormControl.TopLevel        = false;
            _FormControl.Parent          = this;
            _FormControl.FormBorderStyle = FormBorderStyle.Fixed3D;
            _FormControl.ControlBox      = false;
            _FormControl.Left            = (int)(MAINWINDOW_WIDTH - CONTROLWINDOW_WIDTH);
            _FormControl.Top             = 0;
            _FormControl.Width           = (int)CONTROLWINDOW_WIDTH - 20;
            _FormControl.Height          = (int)CONTROLWINDOW_HEIGHT;
            _FormControl.Dock            = DockStyle.Right;
            //显示窗口的背景窗口
            _FormDisplayBG                 = new FormDisplayBG();
            _FormDisplayBG.TopLevel        = false;
            _FormDisplayBG.Parent          = this;
            _FormDisplayBG.FormBorderStyle = FormBorderStyle.None;
            _FormDisplayBG.TopLevel        = false;
            _FormDisplayBG.Hide();

            //显示窗口
            _FormDisplayLst = new FormDisplay[MAX_DEVWINDOW_NUM];
            for (uint i = 0; i < MAX_DEVWINDOW_NUM; i++)
            {
                _FormDisplayLst[i]                 = new FormDisplay();
                _FormDisplayLst[i].TopLevel        = false;
                _FormDisplayLst[i].Parent          = _FormDisplayBG;
                _FormDisplayLst[i].FormBorderStyle = FormBorderStyle.None;
                _FormDisplayLst[i].Hide();
                _FormDisplayLst[i].GetDateDisplay().WndIndex = i;
            }
            this.list_data.Size = new System.Drawing.Size(Width - _FormControl.Width - 30, Height - _FormDisplayLst[0].Height - 320);
            list_data.Font      = new System.Drawing.Font("微软雅黑", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            _FormControl.Height = (int)(CONTROLWINDOW_HEIGHT)-40 - list_data.Size.Height;
            _FormControl.Show();
        }