利用微软com组件mstscax.dll实现window7远程桌面功能
namespace client
{
public partial class login : form
{
private string ip = null;
public login()
{
initializecomponent();
}
public login(string ip)
{
initializecomponent();
ip = ip;
}
private void login_load(object sender, eventargs e)
{
this.formclosing += login_closing;
this.text = string.format("登录到:{0}", ip);
// 获取主机显示器屏幕分辨率
rectangle rect = screen.primaryscreen.bounds;
try
{
rdp.server = ip;
rdp.advancedsettings2.rdpport = 3389;
rdp.height = rect.height;
rdp.width = rect.width;
//rdp.username = "client";
//rdp.advancedsettings2.cleartextpassword = "client";
rdp.connect();
rdp.fullscreen = true;
//this.formborderstyle = formborderstyle.none;
rdp.fullscreentitle = this.text;
}
catch (system.exception ex)
{
messagebox.show(ex.message);
}
}
private void login_closing(object sender, formclosingeventargs e)
{
if (messagebox.show("确认退出么?", "提示", messageboxbuttons.yesno,
messageboxicon.question, messageboxdefaultbutton.button2) == dialogresult.no)
e.cancel = true;
}
}
}