具体代码
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace _16进制累加
{
// Token: 0x02000002 RID: 2
public class Form1 : Form
{
// Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
public Form1()
{
this.InitializeComponent();
}
// Token: 0x06000002 RID: 2 RVA: 0x00002068 File Offset: 0x00000268
private void Form1_Load(object sender, EventArgs e)
{
}
// Token: 0x06000003 RID: 3 RVA: 0x0000206C File Offset: 0x0000026C
private void chaifen(string str)
{
try
{
string[] array = str.Split(new char[]
{
' '
});
int num = 0;
int num2 = 0;
while (!array[num2].Equals("#"))
{
num += Convert.ToInt32(array[num2], 16);
num2++;
}
this.richTextBox2.Text = Convert.ToString(num, 16);
bool flag = !this.radioButton1.Checked;
if (flag)
{
int num3 = int.Parse(this.textBox1.Text);
this.richTextBox2.Text = "运算结果:" + this.richTextBox2.Text.Substring(this.richTextBox2.Text.Length - num3);
}
else
{
this.richTextBox2.Text = "运算结果:" + this.richTextBox2.Text;
}
}
catch
{
MessageBox.Show("您输入的字符串格式错误", "格式错误");
}
}
// Token: 0x06000004 RID: 4 RVA: 0x00002180 File Offset: 0x00000380
private void button1_Click(object sender, EventArgs e)
{
this.chaifen(this.richTextBox1.Text + " #");
}
// Token: 0x06000005 RID: 5 RVA: 0x0000219F File Offset: 0x0000039F
private void richTextBox2_TextChanged(object sender, EventArgs e)
{
}
// Token: 0x06000006 RID: 6 RVA: 0x000021A2 File Offset: 0x000003A2
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
this.textBox1.ReadOnly = true;
}
// Token: 0x06000007 RID: 7 RVA: 0x000021B2 File Offset: 0x000003B2
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
this.textBox1.ReadOnly = false;
}
// Token: 0x06000008 RID: 8 RVA: 0x000021C2 File Offset: 0x000003C2
private void 关于ToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show("作者:小杉杉\nQQ:764854759", "作者信息");
}
// Token: 0x06000009 RID: 9 RVA: 0x000021D8 File Offset: 0x000003D8
protected override void Dispose(bool disposing)
{
bool flag = disposing && this.components != null;
if (flag)
{
this.components.Dispose();
}
base.Dispose(disposing);
}
// Token: 0x0600000A RID: 10 RVA: 0x00002210 File Offset: 0x00000410
private void InitializeComponent()
{
ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(Form1));
this.button1 = new Button();
this.richTextBox1 = new RichTextBox();
this.richTextBox2 = new RichTextBox();
this.radioButton1 = new RadioButton();
this.radioButton2 = new RadioButton();
this.textBox1 = new TextBox();
this.menuStrip1 = new MenuStrip();
this.程序ToolStripMenuItem = new ToolStripMenuItem();
this.关于ToolStripMenuItem = new ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
base.SuspendLayout();
this.button1.Font = new Font("宋体", 15f);
this.button1.Location = new Point(411, 358);
this.button1.Name = "button1";
this.button1.Size = new Size(104, 80);
this.button1.TabIndex = 0;
this.button1.Text = "运算";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += this.button1_Click;
this.richTextBox1.Location = new Point(12, 30);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new Size(503, 300);
this.richTextBox1.TabIndex = 1;
this.richTextBox1.Text = "";
this.richTextBox2.Location = new Point(12, 358);
this.richTextBox2.Name = "richTextBox2";
this.richTextBox2.ReadOnly = true;
this.richTextBox2.Size = new Size(393, 80);
this.richTextBox2.TabIndex = 2;
this.richTextBox2.Text = "";
this.richTextBox2.TextChanged += this.richTextBox2_TextChanged;
this.radioButton1.AutoSize = true;
this.radioButton1.Checked = true;
this.radioButton1.Location = new Point(12, 336);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new Size(71, 16);
this.radioButton1.TabIndex = 3;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "全局截取";
this.radioButton1.UseVisualStyleBackColor = true;
this.radioButton1.CheckedChanged += this.radioButton1_CheckedChanged;
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new Point(113, 336);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new Size(83, 16);
this.radioButton2.TabIndex = 4;
this.radioButton2.Text = "截取后几位";
this.radioButton2.UseVisualStyleBackColor = true;
this.radioButton2.CheckedChanged += this.radioButton2_CheckedChanged;
this.textBox1.Location = new Point(200, 334);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new Size(60, 21);
this.textBox1.TabIndex = 5;
this.textBox1.TextAlign = HorizontalAlignment.Center;
this.menuStrip1.Items.AddRange(new ToolStripItem[]
{
this.程序ToolStripMenuItem
});
this.menuStrip1.Location = new Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new Size(527, 25);
this.menuStrip1.TabIndex = 6;
this.menuStrip1.Text = "menuStrip1";
this.程序ToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[]
{
this.关于ToolStripMenuItem
});
this.程序ToolStripMenuItem.Name = "程序ToolStripMenuItem";
this.程序ToolStripMenuItem.Size = new Size(44, 21);
this.程序ToolStripMenuItem.Text = "程序";
this.关于ToolStripMenuItem.Name = "关于ToolStripMenuItem";
this.关于ToolStripMenuItem.Size = new Size(180, 22);
this.关于ToolStripMenuItem.Text = "关于";
this.关于ToolStripMenuItem.Click += this.关于ToolStripMenuItem_Click;
base.AutoScaleDimensions = new SizeF(6f, 12f);
base.AutoScaleMode = AutoScaleMode.Font;
base.ClientSize = new Size(527, 450);
base.Controls.Add(this.textBox1);
base.Controls.Add(this.radioButton2);
base.Controls.Add(this.radioButton1);
base.Controls.Add(this.richTextBox2);
base.Controls.Add(this.richTextBox1);
base.Controls.Add(this.button1);
base.Controls.Add(this.menuStrip1);
base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
base.MainMenuStrip = this.menuStrip1;
base.Name = "Form1";
base.StartPosition = FormStartPosition.CenterScreen;
this.Text = "十六进制累加器";
base.Load += this.Form1_Load;
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
base.ResumeLayout(false);
base.PerformLayout();
}
// Token: 0x04000001 RID: 1
private IContainer components = null;
// Token: 0x04000002 RID: 2
private Button button1;
// Token: 0x04000003 RID: 3
private RichTextBox richTextBox1;
// Token: 0x04000004 RID: 4
private RichTextBox richTextBox2;
// Token: 0x04000005 RID: 5
private RadioButton radioButton1;
// Token: 0x04000006 RID: 6
private RadioButton radioButton2;
// Token: 0x04000007 RID: 7
private TextBox textBox1;
// Token: 0x04000008 RID: 8
private MenuStrip menuStrip1;
// Token: 0x04000009 RID: 9
private ToolStripMenuItem 程序ToolStripMenuItem;
// Token: 0x0400000A RID: 10
private ToolStripMenuItem 关于ToolStripMenuItem;
}
}
16进制累加器
最新推荐文章于 2024-01-10 00:58:06 发布