private void frmRDP_Load(object sender, EventArgs e) { //Terminal版本为6.1.7601.17514 rdp = new AxMSTSCLib.AxMsRdpClient6(); //布局初始化 rdp.SetBounds(0, 1, this.Size.Width, this.Size.Height - 1); this.Controls.Add(rdp); //将新的控件加入到该集合中(显示) pnlMonitor.BackColor = Color.FromArgb(57, 109, 165); //神之混合(与背景色完全一致) pnlMonitor.Left = this.Size.Width - 620; //500 pnlMonitor.Top = 0; lblDisplay.Left = 3; lblDisplay.Top = 5; btnSwitch.Left = pnlMonitor.Size.Width - 200; btnSwitch.Top = 4; btnBack.Left = pnlMonitor.Size.Width - 120; btnBack.Top = 4; btnLock.Left = pnlMonitor.Size.Width - 60; btnLock.Top = 4; pnlMonitor.Visible = false; if (frmLogin.emc) { btnSwitch.Visible = false; btnBack.Text = "隐藏"; btnLock.Text = "退出"; lblDisplay.Text = "您当前为应急模式 " + frmLogin.emcIP; RefreshStyle(5); initRDP(frmLogin.emcIP, 3389, frmLogin.terUser, frmLogin.terPwd); return; } if (frmTerEnc.offline) { btnLock.Text = "隐藏"; btnSwitch.Visible = false; lblDisplay.Text = "您当前已处于离线模式"; RefreshStyle(4); } else { //定时器开启(实时刷新开始) tmrRefresh.Enabled = true; } initRDP(frmTerEnc.terIP, 3389, frmLogin.terUser, frmLogin.terPwd); }
//一键切换(切换到最闲的机器上去) private void btnSwitch_Click(object sender, EventArgs e) { if (frmTerEnc.terIP == frmTerEnc.minIP) { rdp.Focus(); return; } rdp.Disconnect(); rdp.Dispose(); rdp = new AxMSTSCLib.AxMsRdpClient6(); rdp.SetBounds(0, 1, this.Size.Width, this.Size.Height - 1); this.Controls.Add(rdp); //将新的控件加入到该集合中(显示) initRDP(frmTerEnc.minIP, 3389, frmLogin.terUser, frmLogin.terPwd); frmTerEnc.terIP = frmTerEnc.minIP; }