C#中调用远程桌面时全屏的问题

C#中是可以调用RDP来实现远程桌面的(AxMSTSCLib.AxMsTscAxNotSafeForScripting),但是如何实现全屏了,让远程桌面随窗体大小一直变化。

            RDP1.Dock = DockStyle.None;
            RDP1.Left = 0;
            RDP1.Top = 0;
            RDP1.Width = Screen.PrimaryScreen.Bounds.Width;
            RDP1.Height = Screen.PrimaryScreen.WorkingArea.Height;
          
            string key = "8位key";
            string iv = "8位iv";
            string ip = Main.IPAddress;
            string user = Main.User;
            string pwd = Main.Pwd;
            this.Text = ip + " : 远程桌面连接";
            RDP1.Server = ip;
            if (user != "" && pwd != "") {
                pwd=hr.DESDecrypt(pwd,key,iv);
                RDP1.UserName = user;
                IMsTscNonScriptable secured = (IMsTscNonScriptable)RDP1.GetOcx();
                secured.ClearTextPassword = pwd;
            }
            RDP1.Connect();

就可以很方便的实现连接远程桌面了。

posted @ 2020-12-01 10:47  wjbych  阅读(795)  评论(0编辑  收藏  举报