AxMsTscAxNotSafeForScripting axmstsc = new AxMsTscAxNotSafeForScripting();
WindowsFormsHost wfh = new WindowsFormsHost();
axmstsc.Height =(int) this.ActualHeight;
axmstsc.Width = (int)this.ActualWidth ;
wfh.Child = axmstsc;
sp.Children.Add(wfh);
axmstsc.Server = "10.112.19.156";
axmstsc.UserName=@"dev\dcsadmin";
IMsTscNonScriptable secured = (IMsTscNonScriptable)axmstsc.GetOcx();
secured.ClearTextPassword ="spdb1234";
axmstsc.Connect();
AxMsTscAxNotSafeForScripting是远程桌面的ActiveX Control,需要引用AxMSTSCLib.dll和MSTSCLib.dll,这两个DLL可以从VS命令行中使用AXIMP.EXE mstscax.dll(System32目录下面的远程桌面ActiveX控件)命令来获取,当没有连接的时候,嵌入的控件会显示空白,当连接进入远程电脑的时候,就正常显示桌面了。