远程桌面ActiveX控件最大化

时间:2014-05-18 11:00:57

标签: c# winforms remote-desktop mstsc

在我的申请中,我正在使用Remote Desktop ActiveX control

如何最大化RDP会话?一旦连接,我希望它是全屏的。

1 个答案:

答案 0 :(得分:0)

我不确定你的问题是否通过网络或WinForms应用程序使用它,但如果它来自WinForms应用程序,你可以执行以下操作。

首先,您需要订阅OnConnected事件

  // Subscribe to the OnConnected Event in the constructor or via the form designer.
  this.axMsRdpClient91.OnConnected += new System.EventHandler(this.axMsRdpClient91_OnConnected);


private void btnFullscreen_Click( object sender, EventArgs e )
{
  if ( axMsRdpClient91.Connected == 0 )
  {

    axMsRdpClient91.UserName = "Username";
    axMsRdpClient91.Server = "address to server to connect to";
    // Connect to the server
    axMsRdpClient91.Connect();
  }

}
// When the the ActiveXControl raises the OnConnected event set the screen to full screen mode.
private void axMsRdpClient91_OnConnected( object sender, EventArgs e )
{
  ( (AxMSTSCLib.AxMsRdpClient9)sender ).FullScreen = true;
}