在好例子网,分享、交流、成长!
您当前所在位置:首页C# 开发实例C#语言基础 → 生成mstsc用的rdp文件(远程桌面文件)

生成mstsc用的rdp文件(远程桌面文件)

C#语言基础

下载此实例
  • 开发语言:C#
  • 实例大小:0.24M
  • 下载次数:74
  • 浏览次数:4482
  • 发布时间:2015-11-04
  • 实例类别:C#语言基础
  • 发 布 人:longang520
  • 文件格式:.rar
  • 所需积分:2
 相关标签: 文件 RDP

实例介绍

【实例简介】

【实例截图】

from clipboard


from clipboard



生成的rdp文件如下:

from clipboard

【核心代码】

namespace MstscHelper
{
    using Crypt32;
    using Les.Util;
    using System;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.IO;
    using System.Windows.Forms;

    public class frmMain : Form
    {
        private Button btnCreateFile;
        private Button btnRefresh;
        private Button btnRunRdp;
        private Button btnViewAdvOptions;
        private Button btnViewParam;
        private ComboBox cbRdps;
        private CheckBox cbScreenMode;
        private CheckBox cbUseConsoleSession;
        private CheckBox cbUseDomain;
        private CheckBox cbUseOtherPort;
        private IContainer components;
        private Label label1;
        private Label label2;
        private Label lblDesktopHeight;
        private Label lblDesktopWidth;
        private Label lblDomain;
        private Label lblDomainInfo;
        private Label lblPassword;
        private Label lblPort;
        private Label lblPortInfo;
        private Label lblServer;
        private Label lblUserName;
        private Panel panel1;
        private IPlugin plugin;
        private Panel pnlAdvOptions;
        public static string RdpFileTemplate = "screen mode id:i:{0}\r\ndesktopwidth:i:{1}\r\ndesktopheight:i:{2}\r\nsession bpp:i:16\r\nfull address:s:{3}\r\nconnect to console:i:{4}\r\ncompression:i:1\r\nkeyboardhook:i:2\r\naudiomode:i:2\r\nredirectdrives:i:1\r\nredirectprinters:i:0\r\nredirectcomports:i:0\r\nredirectsmartcards:i:0\r\ndisplayconnectionbar:i:1\r\nautoreconnection enabled:i:1\r\ndomain:s:{5}\r\nusername:s:{6}\r\npassword 51:b:{7}\r\nauthentication level:i:0\r\nprompt for credentials:i:0\r\ndisable wallpaper:i:0\r\ndisable full window drag:i:1\r\ndisable themes:i:0\r\ndisable cursor setting:i:1\r\nbitmapcachepersistenable:i:1";
        private TabControl tabControl1;
        private TextBox tbDesktopHeight;
        private TextBox tbDesktopWidth;
        private TextBox tbDomain;
        private TextBox tbParam;
        private TextBox tbPassword;
        private TextBox tbPort;
        private TextBox tbServer;
        private TextBox tbUserName;
        private TabPage tpMain;
        private TabPage tpParam;

        public frmMain()
        {
            this.InitializeComponent();
        }

        public frmMain(IPlugin ipi)
        {
            this.plugin = ipi;
            this.InitializeComponent();
        }

        private void btnCreateFile_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.tbServer.Text))
            {
                MessageBox.Show("服务器地址不可为空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.tbServer.Focus();
            }
            else
            {
                string str = this.cbUseDomain.Checked ? this.tbDomain.Text.Trim() : "";
                string str2 = this.cbUseConsoleSession.Checked ? "1" : "0";
                string str3 = this.tbPort.Text.Trim();
                if (this.cbUseOtherPort.Checked && !string.IsNullOrEmpty(str3))
                {
                    bool flag = false;
                    try
                    {
                        if (Convert.ToInt16(str3) <= 0)
                        {
                            flag = true;
                        }
                    }
                    catch (Exception)
                    {
                        flag = true;
                    }
                    if (flag)
                    {
                        MessageBox.Show(string.Format("{0}不是有效的端口号。", str3), "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        return;
                    }
                }
                string str4 = this.tbDesktopWidth.Text.Trim();
                string str5 = this.tbDesktopHeight.Text.Trim();
                string str6 = this.tbUserName.Text.Trim();
                foreach (string str7 in this.tbServer.Text.Trim().Split(new char[] { ';' }))
                {
                    if (!IsValidIpAddress(str7))
                    {
                        MessageBox.Show(string.Format("{0}不是有效的Ip地址。", str7), "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    else
                    {
                        string path = FileUtil.AssembleDirName   @"\rdp\";
                        if (!Directory.Exists(path))
                        {
                            Directory.CreateDirectory(path);
                        }
                        string str9 = path   @"\"   str7   ".rdp";
                        if (File.Exists(str9))
                        {
                            FileUtil.DeleteFile(str9);
                        }
                        string str10 = this.tbPassword.Text.Trim();
                        if (!string.IsNullOrEmpty(str10))
                        {
                            str10 = DPAPI.Encrypt(str10).Replace("-", "");
                        }
                        string str11 = this.cbScreenMode.Checked ? "1" : "2";
                        string str12 = str7;
                        if (this.cbUseOtherPort.Checked)
                        {
                            str12 = str12   ":"   str3;
                        }
                        FileUtil.WriteToTxtFile(str9, string.Format(RdpFileTemplate, new object[] { str11, str4, str5, str12, str2, str, str6, str10 }));
                    }
                }
                MessageBox.Show("生成完毕!", "提示");
            }
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            this.GetRdps();
            string path = FileUtil.AssembleDirName   @"\template.txt";
            if (File.Exists(path))
            {
                RdpFileTemplate = FileUtil.ReadFromTxtFile(path);
            }
        }

        private void btnRunRdp_Click(object sender, EventArgs e)
        {
            if (this.cbRdps.SelectedIndex != -1)
            {
                string path = FileUtil.AssembleDirName   @"\rdp\"   this.cbRdps.SelectedItem.ToString()   ".rdp";
                if (File.Exists(path))
                {
                    Process process = new Process();
                    process.StartInfo.FileName = path;
                    process.StartInfo.UseShellExecute = true;
                    process.Start();
                }
                else
                {
                    MessageBox.Show(string.Format("rdp目录下文件{0}不存在", this.cbRdps.SelectedValue.ToString()), "警告");
                }
            }
        }

        private void btnViewAdvOptions_Click(object sender, EventArgs e)
        {
            if (!this.pnlAdvOptions.Visible)
            {
                this.pnlAdvOptions.Visible = true;
                this.btnViewAdvOptions.Text = "隐藏高级选项";
            }
            else
            {
                this.pnlAdvOptions.Visible = false;
                this.btnViewAdvOptions.Text = "显示高级选项";
            }
        }

        private void btnViewParam_Click(object sender, EventArgs e)
        {
            if (!this.tbParam.Visible)
            {
                this.tbParam.Visible = true;
                this.btnViewParam.Text = "隐藏配置";
            }
            else
            {
                this.tbParam.Visible = false;
                this.btnViewParam.Text = "查看配置";
            }
        }

        private void cbRdps_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.cbRdps.SelectedIndex != -1)
            {
                string path = FileUtil.AssembleDirName   @"\rdp\"   this.cbRdps.SelectedItem.ToString()   ".rdp";
                if (File.Exists(path))
                {
                    this.tbParam.Text = FileUtil.ReadFromTxtFile(path);
                }
                else
                {
                    MessageBox.Show(string.Format("rdp目录下文件{0}不存在", this.cbRdps.SelectedValue.ToString()), "警告");
                }
            }
        }

        private void cbScreenMode_CheckedChanged(object sender, EventArgs e)
        {
            this.lblDesktopWidth.Enabled = this.cbScreenMode.Checked;
            this.tbDesktopWidth.Enabled = this.cbScreenMode.Checked;
            this.lblDesktopHeight.Enabled = this.cbScreenMode.Checked;
            this.tbDesktopHeight.Enabled = this.cbScreenMode.Checked;
        }

        private void cbUseDomain_CheckedChanged(object sender, EventArgs e)
        {
            this.lblDomain.Enabled = this.cbUseDomain.Checked;
            this.lblDomainInfo.Enabled = this.cbUseDomain.Checked;
            this.tbDomain.Enabled = this.cbUseDomain.Checked;
        }

        private void cbUseOtherPort_CheckedChanged(object sender, EventArgs e)
        {
            this.lblPort.Enabled = this.cbUseOtherPort.Checked;
            this.tbPort.Enabled = this.cbUseOtherPort.Checked;
            this.lblPortInfo.Enabled = this.cbUseOtherPort.Checked;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void frmMain_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (this.plugin != null)
            {
                this.plugin.Host.PluginClose(this.plugin);
            }
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            this.GetRdps();
            string path = FileUtil.AssembleDirName   @"\template.txt";
            if (File.Exists(path))
            {
                RdpFileTemplate = FileUtil.ReadFromTxtFile(path);
            }
        }

        private void GetRdps()
        {
            string path = FileUtil.AssembleDirName   @"\rdp\";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string[] strArray = FileUtil.GetAllFiles(path, "*.rdp", false);
            this.cbRdps.Items.Clear();
            foreach (string str2 in strArray)
            {
                this.cbRdps.Items.Add(FileUtil.FileMainNameOf(str2));
            }
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(frmMain));
            this.tabControl1 = new TabControl();
            this.tpMain = new TabPage();
            this.btnRefresh = new Button();
            this.tbParam = new TextBox();
            this.btnViewParam = new Button();
            this.btnRunRdp = new Button();
            this.cbRdps = new ComboBox();
            this.label1 = new Label();
            this.tpParam = new TabPage();
            this.label2 = new Label();
            this.pnlAdvOptions = new Panel();
            this.cbUseDomain = new CheckBox();
            this.lblDomainInfo = new Label();
            this.cbUseOtherPort = new CheckBox();
            this.tbDesktopHeight = new TextBox();
            this.lblDesktopHeight = new Label();
            this.tbDesktopWidth = new TextBox();
            this.lblDesktopWidth = new Label();
            this.cbScreenMode = new CheckBox();
            this.cbUseConsoleSession = new CheckBox();
            this.lblPortInfo = new Label();
            this.tbPort = new TextBox();
            this.lblPort = new Label();
            this.tbDomain = new TextBox();
            this.lblDomain = new Label();
            this.tbPassword = new TextBox();
            this.lblPassword = new Label();
            this.tbUserName = new TextBox();
            this.lblUserName = new Label();
            this.tbServer = new TextBox();
            this.lblServer = new Label();
            this.panel1 = new Panel();
            this.btnViewAdvOptions = new Button();
            this.btnCreateFile = new Button();
            this.tabControl1.SuspendLayout();
            this.tpMain.SuspendLayout();
            this.tpParam.SuspendLayout();
            this.pnlAdvOptions.SuspendLayout();
            this.panel1.SuspendLayout();
            base.SuspendLayout();
            this.tabControl1.Controls.Add(this.tpMain);
            this.tabControl1.Controls.Add(this.tpParam);
            this.tabControl1.Dock = DockStyle.Fill;
            this.tabControl1.Location = new Point(0, 0);
            this.tabControl1.Name = "tabControl1";
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.Size = new Size(0x1fa, 0x169);
            this.tabControl1.TabIndex = 0;
            this.tpMain.Controls.Add(this.btnRefresh);
            this.tpMain.Controls.Add(this.tbParam);
            this.tpMain.Controls.Add(this.btnViewParam);
            this.tpMain.Controls.Add(this.btnRunRdp);
            this.tpMain.Controls.Add(this.cbRdps);
            this.tpMain.Controls.Add(this.label1);
            this.tpMain.Location = new Point(4, 0x15);
            this.tpMain.Name = "tpMain";
            this.tpMain.Padding = new Padding(3);
            this.tpMain.Size = new Size(0x1f2, 0x150);
            this.tpMain.TabIndex = 0;
            this.tpMain.Text = "生成";
            this.tpMain.UseVisualStyleBackColor = true;
            this.btnRefresh.FlatStyle = FlatStyle.Popup;
            this.btnRefresh.Location = new Point(0x5b, 0x2d);
            this.btnRefresh.Name = "btnRefresh";
            this.btnRefresh.Size = new Size(0x4b, 0x17);
            this.btnRefresh.TabIndex = 5;
            this.btnRefresh.Text = "刷新";
            this.btnRefresh.UseVisualStyleBackColor = true;
            this.btnRefresh.Click  = new EventHandler(this.btnRefresh_Click);
            this.tbParam.Location = new Point(10, 0x4a);
            this.tbParam.Multiline = true;
            this.tbParam.Name = "tbParam";
            this.tbParam.ReadOnly = true;
            this.tbParam.ScrollBars = ScrollBars.Vertical;
            this.tbParam.Size = new Size(0x1ce, 0xfe);
            this.tbParam.TabIndex = 4;
            this.tbParam.Visible = false;
            this.btnViewParam.FlatStyle = FlatStyle.Popup;
            this.btnViewParam.Location = new Point(10, 0x2d);
            this.btnViewParam.Name = "btnViewParam";
            this.btnViewParam.Size = new Size(0x4b, 0x17);
            this.btnViewParam.TabIndex = 3;
            this.btnViewParam.Text = "查看配置";
            this.btnViewParam.UseVisualStyleBackColor = true;
            this.btnViewParam.Click  = new EventHandler(this.btnViewParam_Click);
            this.btnRunRdp.FlatStyle = FlatStyle.Popup;
            this.btnRunRdp.Location = new Point(0x176, 14);
            this.btnRunRdp.Name = "btnRunRdp";
            this.btnRunRdp.Size = new Size(0x62, 0x17);
            this.btnRunRdp.TabIndex = 2;
            this.btnRunRdp.Text = "启动远程桌面";
            this.btnRunRdp.UseVisualStyleBackColor = true;
            this.btnRunRdp.Click  = new EventHandler(this.btnRunRdp_Click);
            this.cbRdps.DropDownStyle = ComboBoxStyle.DropDownList;
            this.cbRdps.FormattingEnabled = true;
            this.cbRdps.Location = new Point(0x5b, 0x10);
            this.cbRdps.Name = "cbRdps";
            this.cbRdps.Size = new Size(0x115, 20);
            this.cbRdps.TabIndex = 1;
            this.cbRdps.SelectedIndexChanged  = new EventHandler(this.cbRdps_SelectedIndexChanged);
            this.label1.AutoSize = true;
            this.label1.Location = new Point(8, 0x13);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x4d, 12);
            this.label1.TabIndex = 0;
            this.label1.Text = "选择rdp配置:";
            this.tpParam.Controls.Add(this.label2);
            this.tpParam.Controls.Add(this.pnlAdvOptions);
            this.tpParam.Controls.Add(this.tbPassword);
            this.tpParam.Controls.Add(this.lblPassword);
            this.tpParam.Controls.Add(this.tbUserName);
            this.tpParam.Controls.Add(this.lblUserName);
            this.tpParam.Controls.Add(this.tbServer);
            this.tpParam.Controls.Add(this.lblServer);
            this.tpParam.Controls.Add(this.panel1);
            this.tpParam.Location = new Point(4, 0x15);
            this.tpParam.Name = "tpParam";
            this.tpParam.Padding = new Padding(3);
            this.tpParam.Size = new Size(0x1f2, 0x150);
            this.tpParam.TabIndex = 1;
            this.tpParam.Text = "参数";
            this.tpParam.UseVisualStyleBackColor = true;
            this.label2.AutoSize = true;
            this.label2.Location = new Point(0x178, 40);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x77, 12);
            this.label2.TabIndex = 8;
            this.label2.Text = "多个地址以分号;分隔";
            this.pnlAdvOptions.BorderStyle = BorderStyle.FixedSingle;
            this.pnlAdvOptions.Controls.Add(this.cbUseDomain);
            this.pnlAdvOptions.Controls.Add(this.lblDomainInfo);
            this.pnlAdvOptions.Controls.Add(this.cbUseOtherPort);
            this.pnlAdvOptions.Controls.Add(this.tbDesktopHeight);
            this.pnlAdvOptions.Controls.Add(this.lblDesktopHeight);
            this.pnlAdvOptions.Controls.Add(this.tbDesktopWidth);
            this.pnlAdvOptions.Controls.Add(this.lblDesktopWidth);
            this.pnlAdvOptions.Controls.Add(this.cbScreenMode);
            this.pnlAdvOptions.Controls.Add(this.cbUseConsoleSession);
            this.pnlAdvOptions.Controls.Add(this.lblPortInfo);
            this.pnlAdvOptions.Controls.Add(this.tbPort);
            this.pnlAdvOptions.Controls.Add(this.lblPort);
            this.pnlAdvOptions.Controls.Add(this.tbDomain);
            this.pnlAdvOptions.Controls.Add(this.lblDomain);
            this.pnlAdvOptions.Location = new Point(6, 120);
            this.pnlAdvOptions.Name = "pnlAdvOptions";
            this.pnlAdvOptions.Size = new Size(0x1e4, 0xd0);
            this.pnlAdvOptions.TabIndex = 7;
            this.pnlAdvOptions.Visible = false;
            this.cbUseDomain.AutoSize = true;
            this.cbUseDomain.Location = new Point(5, 13);
            this.cbUseDomain.Name = "cbUseDomain";
            this.cbUseDomain.Size = new Size(0x48, 0x10);
            this.cbUseDomain.TabIndex = 20;
            this.cbUseDomain.Text = "指定域名";
            this.cbUseDomain.UseVisualStyleBackColor = true;
            this.cbUseDomain.CheckedChanged  = new EventHandler(this.cbUseDomain_CheckedChanged);
            this.lblDomainInfo.AutoSize = true;
            this.lblDomainInfo.Enabled = false;
            this.lblDomainInfo.Location = new Point(0x120, 0x29);
            this.lblDomainInfo.Name = "lblDomainInfo";
            this.lblDomainInfo.Size = new Size(0x8f, 12);
            this.lblDomainInfo.TabIndex = 0x13;
            this.lblDomainInfo.Text = "(登录时使用,一般可不填)";
            this.cbUseOtherPort.AutoSize = true;
            this.cbUseOtherPort.Location = new Point(5, 0x43);
            this.cbUseOtherPort.Name = "cbUseOtherPort";
            this.cbUseOtherPort.Size = new Size(0x48, 0x10);
            this.cbUseOtherPort.TabIndex = 0x12;
            this.cbUseOtherPort.Text = "指定端口";
            this.cbUseOtherPort.UseVisualStyleBackColor = true;
            this.cbUseOtherPort.CheckedChanged  = new EventHandler(this.cbUseOtherPort_CheckedChanged);
            this.tbDesktopHeight.Enabled = false;
            this.tbDesktopHeight.Location = new Point(0x100, 0xaf);
            this.tbDesktopHeight.Name = "tbDesktopHeight";
            this.tbDesktopHeight.Size = new Size(0x6b, 0x15);
            this.tbDesktopHeight.TabIndex = 0x11;
            this.tbDesktopHeight.Text = "768";
            this.lblDesktopHeight.AutoSize = true;
            this.lblDesktopHeight.Enabled = false;
            this.lblDesktopHeight.Location = new Point(0xcb, 0xb3);
            this.lblDesktopHeight.Name = "lblDesktopHeight";
            this.lblDesktopHeight.Size = new Size(0x2f, 12);
            this.lblDesktopHeight.TabIndex = 0x10;
            this.lblDesktopHeight.Text = "高  度:";
            this.tbDesktopWidth.Enabled = false;
            this.tbDesktopWidth.Location = new Point(0x53, 0xaf);
            this.tbDesktopWidth.Name = "tbDesktopWidth";
            this.tbDesktopWidth.Size = new Size(0x6b, 0x15);
            this.tbDesktopWidth.TabIndex = 15;
            this.tbDesktopWidth.Text = "1024";
            this.lblDesktopWidth.AutoSize = true;
            this.lblDesktopWidth.Enabled = false;
            this.lblDesktopWidth.Location = new Point(30, 0xb3);
            this.lblDesktopWidth.Name = "lblDesktopWidth";
            this.lblDesktopWidth.Size = new Size(0x2f, 12);
            this.lblDesktopWidth.TabIndex = 14;
            this.lblDesktopWidth.Text = "宽  度:";
            this.cbScreenMode.AutoSize = true;
            this.cbScreenMode.Location = new Point(5, 0x99);
            this.cbScreenMode.Name = "cbScreenMode";
            this.cbScreenMode.Size = new Size(0xa8, 0x10);
            this.cbScreenMode.TabIndex = 13;
            this.cbScreenMode.Text = "指定窗口大小(不使用全屏)";
            this.cbScreenMode.UseVisualStyleBackColor = true;
            this.cbScreenMode.CheckedChanged  = new EventHandler(this.cbScreenMode_CheckedChanged);
            this.cbUseConsoleSession.AutoSize = true;
            this.cbUseConsoleSession.Location = new Point(5, 0x7a);
            this.cbUseConsoleSession.Name = "cbUseConsoleSession";
            this.cbUseConsoleSession.Size = new Size(0x72, 0x10);
            this.cbUseConsoleSession.TabIndex = 12;
            this.cbUseConsoleSession.Text = "使用Console连接";
            this.cbUseConsoleSession.UseVisualStyleBackColor = true;
            this.lblPortInfo.AutoSize = true;
            this.lblPortInfo.Enabled = false;
            this.lblPortInfo.Location = new Point(0x11e, 0x5c);
            this.lblPortInfo.Name = "lblPortInfo";
            this.lblPortInfo.Size = new Size(0x4d, 12);
            this.lblPortInfo.TabIndex = 11;
            this.lblPortInfo.Text = "(默认是3389)";
            this.tbPort.Enabled = false;
            this.tbPort.Location = new Point(0x53, 0x59);
            this.tbPort.Name = "tbPort";
            this.tbPort.Size = new Size(0xc5, 0x15);
            this.tbPort.TabIndex = 10;
            this.tbPort.Text = "3389";
            this.lblPort.AutoSize = true;
            this.lblPort.Enabled = false;
            this.lblPort.Location = new Point(30, 0x5f);
            this.lblPort.Name = "lblPort";
            this.lblPort.Size = new Size(0x2f, 12);
            this.lblPort.TabIndex = 9;
            this.lblPort.Text = "端  口:";
            this.tbDomain.Enabled = false;
            this.tbDomain.Location = new Point(0x53, 0x25);
            this.tbDomain.Name = "tbDomain";
            this.tbDomain.Size = new Size(0xc5, 0x15);
            this.tbDomain.TabIndex = 8;
            this.lblDomain.AutoSize = true;
            this.lblDomain.Enabled = false;
            this.lblDomain.Location = new Point(30, 0x29);
            this.lblDomain.Name = "lblDomain";
            this.lblDomain.Size = new Size(0x2f, 12);
            this.lblDomain.TabIndex = 7;
            this.lblDomain.Text = "域  名:";
            this.tbPassword.Location = new Point(0x3e, 0x5b);
            this.tbPassword.Name = "tbPassword";
            this.tbPassword.PasswordChar = '*';
            this.tbPassword.Size = new Size(0x133, 0x15);
            this.tbPassword.TabIndex = 6;
            this.lblPassword.AutoSize = true;
            this.lblPassword.Location = new Point(9, 0x5f);
            this.lblPassword.Name = "lblPassword";
            this.lblPassword.Size = new Size(0x2f, 12);
            this.lblPassword.TabIndex = 5;
            this.lblPassword.Text = "密  码:";
            this.tbUserName.Location = new Point(0x3e, 0x40);
            this.tbUserName.Name = "tbUserName";
            this.tbUserName.Size = new Size(0x133, 0x15);
            this.tbUserName.TabIndex = 4;
            this.lblUserName.AutoSize = true;
            this.lblUserName.Location = new Point(9, 0x44);
            this.lblUserName.Name = "lblUserName";
            this.lblUserName.Size = new Size(0x2f, 12);
            this.lblUserName.TabIndex = 3;
            this.lblUserName.Text = "用户名:";
            this.tbServer.Location = new Point(0x3e, 0x25);
            this.tbServer.Name = "tbServer";
            this.tbServer.Size = new Size(0x133, 0x15);
            this.tbServer.TabIndex = 2;
            this.lblServer.AutoSize = true;
            this.lblServer.Location = new Point(9, 0x29);
            this.lblServer.Name = "lblServer";
            this.lblServer.Size = new Size(0x2f, 12);
            this.lblServer.TabIndex = 1;
            this.lblServer.Text = "服务器:";
            this.panel1.Controls.Add(this.btnViewAdvOptions);
            this.panel1.Controls.Add(this.btnCreateFile);
            this.panel1.Dock = DockStyle.Top;
            this.panel1.Location = new Point(3, 3);
            this.panel1.Name = "panel1";
            this.panel1.Size = new Size(0x1ec, 30);
            this.panel1.TabIndex = 0;
            this.btnViewAdvOptions.FlatStyle = FlatStyle.Popup;
            this.btnViewAdvOptions.Location = new Point(0x108, 4);
            this.btnViewAdvOptions.Name = "btnViewAdvOptions";
            this.btnViewAdvOptions.Size = new Size(0x66, 0x17);
            this.btnViewAdvOptions.TabIndex = 1;
            this.btnViewAdvOptions.Text = "显示高级选项";
            this.btnViewAdvOptions.UseVisualStyleBackColor = true;
            this.btnViewAdvOptions.Click  = new EventHandler(this.btnViewAdvOptions_Click);
            this.btnCreateFile.FlatStyle = FlatStyle.Popup;
            this.btnCreateFile.Location = new Point(0x17f, 4);
            this.btnCreateFile.Name = "btnCreateFile";
            this.btnCreateFile.Size = new Size(0x68, 0x17);
            this.btnCreateFile.TabIndex = 0;
            this.btnCreateFile.Text = "生成RDP文件";
            this.btnCreateFile.UseVisualStyleBackColor = true;
            this.btnCreateFile.Click  = new EventHandler(this.btnCreateFile_Click);
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x1fa, 0x169);
            base.Controls.Add(this.tabControl1);
            base.FormBorderStyle = FormBorderStyle.FixedSingle;
            base.Icon = (Icon) manager.GetObject("$this.Icon");
            base.MaximizeBox = false;
            base.Name = "frmMain";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "Windows远程桌面帮助";
            base.Load  = new EventHandler(this.frmMain_Load);
            base.FormClosed  = new FormClosedEventHandler(this.frmMain_FormClosed);
            this.tabControl1.ResumeLayout(false);
            this.tpMain.ResumeLayout(false);
            this.tpMain.PerformLayout();
            this.tpParam.ResumeLayout(false);
            this.tpParam.PerformLayout();
            this.pnlAdvOptions.ResumeLayout(false);
            this.pnlAdvOptions.PerformLayout();
            this.panel1.ResumeLayout(false);
            base.ResumeLayout(false);
        }

        private static bool IsValidIpAddress(string ip)
        {
            string[] strArray = ip.Split(new char[] { '.' });
            if (strArray.Length != 4)
            {
                return false;
            }
            foreach (string str in strArray)
            {
                try
                {
                    int num = Convert.ToInt16(str);
                    if ((num < 0) || (num > 0xff))
                    {
                        return false;
                    }
                }
                catch (Exception)
                {
                    return false;
                }
            }
            return true;
        }
    }
}


标签: 文件 RDP

实例下载地址

生成mstsc用的rdp文件(远程桌面文件)

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警