📄 settings.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using sanpack_rsa_csclass;
namespace sanpack_rsa_dotnet11
{
/// <summary>
/// settings 的摘要说明。
/// </summary>
public class settings : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label4;
private RSAform f;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public settings(RSAform af)
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
f=af;
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(settings));
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(184, 16);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(136, 21);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "1";
this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(184, 56);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(136, 21);
this.textBox2.TabIndex = 1;
this.textBox2.Text = "35";
this.textBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(184, 96);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(136, 21);
this.textBox3.TabIndex = 2;
this.textBox3.Text = "35";
this.textBox3.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// label1
//
this.label1.Location = new System.Drawing.Point(40, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(128, 24);
this.label1.TabIndex = 3;
this.label1.Text = "每次加密运算的字节数";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// label2
//
this.label2.Location = new System.Drawing.Point(-8, 56);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(184, 24);
this.label2.TabIndex = 4;
this.label2.Text = "寻找素数随机起点的字节数A";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label2.Click += new System.EventHandler(this.label2_Click);
//
// label3
//
this.label3.Location = new System.Drawing.Point(-8, 96);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(184, 24);
this.label3.TabIndex = 4;
this.label3.Text = "寻找素数随机起点的字节数B";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// button1
//
this.button1.Location = new System.Drawing.Point(64, 128);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(88, 24);
this.button1.TabIndex = 5;
this.button1.Text = "重新输入";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(192, 128);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(88, 24);
this.button2.TabIndex = 5;
this.button2.Text = "确定";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label4
//
this.label4.Location = new System.Drawing.Point(16, 168);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(320, 40);
this.label4.TabIndex = 6;
this.label4.Text = "第一项设定必须为文件长度的约数,且不宜过大,推荐值为1或2。第二、三项推荐35字节,可根据机器速度尝试设定更大的值";
//
// settings
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(338, 215);
this.Controls.Add(this.label4);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label3);
this.Controls.Add(this.button2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "settings";
this.ShowInTaskbar = false;
this.Text = "RSA位数设定";
this.Closing += new System.ComponentModel.CancelEventHandler(this.settings_Closing);
this.Load += new System.EventHandler(this.settings_Load);
this.ResumeLayout(false);
}
#endregion
private void label1_Click(object sender, System.EventArgs e)
{
}
private void settings_Load(object sender, System.EventArgs e)
{
f.Enabled=false;
this.SetDesktopLocation(Screen.PrimaryScreen.WorkingArea.Width/2-this.Size.Width/2,
Screen.PrimaryScreen.WorkingArea.Height/2-this.Size.Height/2);
textBox1.Text=Sanpack_rsa.RSAstep.ToString();
textBox2.Text=Sanpack_rsa.RSAprimeplen1.ToString();
textBox3.Text=Sanpack_rsa.RSAprimeplen2.ToString();
}
private void settings_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
f.Enabled=true;
f.Focus();
}
private void button2_Click(object sender, System.EventArgs e)
{
Sanpack_rsa.RSAstep=System.Convert.ToUInt32(textBox1.Text);
Sanpack_rsa.RSAprimeplen1=System.Convert.ToUInt32(textBox2.Text);
Sanpack_rsa.RSAprimeplen2=System.Convert.ToUInt32(textBox3.Text);
this.Close();
f.Enabled=true;
f.Focus();
this.Dispose();
}
private void button1_Click(object sender, System.EventArgs e)
{
textBox1.Text=Sanpack_rsa.RSAstep.ToString();
textBox2.Text=Sanpack_rsa.RSAprimeplen1.ToString();
textBox3.Text=Sanpack_rsa.RSAprimeplen2.ToString();
}
private void label2_Click(object sender, System.EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -