📄 form1.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.IO;
namespace client
{
//Form1 的说明.
public class Form1 : System.Windows.Forms.Form
{
//四个GroupBox控件,包括控制设置,记录窗口,连接窗口,发送控制.
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.GroupBox groupBox4;
//11个Button控件,包括修改选项,恢复修改,修改位置,卸载控制,请求连接,测试连接,控制生效,保存记录,查看记录.
//多余的两个button用于扩展新空能.
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.Button button10;
private System.Windows.Forms.Button button11;
//1个RichTextBox控件,用于控制记录的查看看窗口.
private System.Windows.Forms.RichTextBox richTextBox1;
//1个TextBox控件,用于输入所要控制主机的IP.
private System.Windows.Forms.TextBox textBox1;
//1个Label控件,显示说明文字"主机名称".
private System.Windows.Forms.Label label1;
//4个RadioButton控件,包括修改注册表,恢复修改,修改控制位置,卸载控制.
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton5;
private System.Windows.Forms.RadioButton radioButton6;
//其他成员的引用.
private TcpClient client;
private NetworkStream stream;
private Thread thread;
//预设6位控制码,卸载控制码removing预设为000000.
private string removing = "000000";
//修改注册表与恢复注册表的控制码预设为000000.
private string control = "000000";
public Form2 form2;
public Form3 form3;
public Form4 form4;
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.radioButton6 = new System.Windows.Forms.RadioButton();
this.radioButton5 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.button11 = new System.Windows.Forms.Button();
this.button10 = new System.Windows.Forms.Button();
this.button9 = new System.Windows.Forms.Button();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button4);
this.groupBox1.Controls.Add(this.button3);
this.groupBox1.Controls.Add(this.button7);
this.groupBox1.Controls.Add(this.button8);
this.groupBox1.Location = new System.Drawing.Point(8, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(248, 176);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "控制设置";
//
// button4
//
this.button4.Location = new System.Drawing.Point(144, 39);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 3;
this.button4.Text = "恢复修改";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(16, 39);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 2;
this.button3.Text = "修改选项";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button7
//
this.button7.Location = new System.Drawing.Point(16, 105);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(75, 23);
this.button7.TabIndex = 2;
this.button7.Text = "修改位置";
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// button8
//
this.button8.Location = new System.Drawing.Point(144, 105);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(75, 23);
this.button8.TabIndex = 3;
this.button8.Text = "卸载控制";
this.button8.Click += new System.EventHandler(this.button8_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.richTextBox1);
this.groupBox2.Location = new System.Drawing.Point(256, 8);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(248, 176);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "记录窗口";
//
// richTextBox1
//
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point(3, 17);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(242, 156);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.label1);
this.groupBox3.Controls.Add(this.textBox1);
this.groupBox3.Controls.Add(this.button1);
this.groupBox3.Controls.Add(this.button2);
this.groupBox3.Location = new System.Drawing.Point(8, 184);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(248, 120);
this.groupBox3.TabIndex = 2;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "连接窗口";
//
// label1
//
this.label1.Location = new System.Drawing.Point(24, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 24);
this.label1.TabIndex = 1;
this.label1.Text = "主机名称:";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(104, 24);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(136, 21);
this.textBox1.TabIndex = 0;
//
// button1
//
this.button1.Location = new System.Drawing.Point(16, 72);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "请求连接";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(136, 72);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1;
this.button2.Text = "测试连接";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// groupBox4
//
this.groupBox4.Controls.Add(this.radioButton6);
this.groupBox4.Controls.Add(this.radioButton5);
this.groupBox4.Controls.Add(this.radioButton2);
this.groupBox4.Controls.Add(this.radioButton1);
this.groupBox4.Controls.Add(this.button11);
this.groupBox4.Controls.Add(this.button10);
this.groupBox4.Controls.Add(this.button9);
this.groupBox4.Location = new System.Drawing.Point(256, 184);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(248, 120);
this.groupBox4.TabIndex = 3;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "发送控制";
//
// radioButton6
//
this.radioButton6.Location = new System.Drawing.Point(120, 58);
this.radioButton6.Name = "radioButton6";
this.radioButton6.Size = new System.Drawing.Size(104, 24);
this.radioButton6.TabIndex = 8;
this.radioButton6.Text = "卸载控制";
//
// radioButton5
//
this.radioButton5.Location = new System.Drawing.Point(8, 58);
this.radioButton5.Name = "radioButton5";
this.radioButton5.Size = new System.Drawing.Size(104, 24);
this.radioButton5.TabIndex = 7;
this.radioButton5.Text = "修改控制位置";
//
// radioButton2
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -