c#完成的数制转换器---ShinePans
来源:互联网 发布:2017学生空间七天网络 编辑:程序博客网 时间:2024/06/05 11:11
/ / NUMBER_CONVERT的功能/ / 2,8,10,16转换到对方/ /时间:2014-3/ /版本:1.0/ /通过:ShinePans使用系统;使用System.Drawing;使用System.Collections;使用System.ComponentModel;使用System.Windows.Forms的; / /当一些“使用”无法找到,我们应该增加一些 / /会议。使用System.Data;命名空间NumConvert { 公共类Form1中:System.Windows.Forms.Form中 { 私人System.Windows.Forms.GroupBox groupBox1; 私人System.Windows.Forms.Label LABEL1; 私人System.Windows.Forms.Label LABEL2; 私人System.Windows.Forms.TextBox textBox1的; 私人System.Windows.Forms.TextBox textBox2中; 私人System.Windows.Forms.GroupBox groupBox2; 私人System.Windows.Forms.Label LABEL3; 私人System.Windows.Forms.Label Label4的; 私人System.Windows.Forms.Label label5; 私人System.Windows.Forms.GroupBox groupBox3; 私人System.Windows.Forms.TextBox TextBox3的; 私人System.Windows.Forms.TextBox textBox4; 私人System.Windows.Forms.TextBox textBox5; 私人System.Windows.Forms.Button button1的; 私人System.Windows.Forms.Button按钮2; 私人System.Windows.Forms.Label label6; 私人System.Windows.Forms.Timer定时器1; 私人System.ComponentModel.IContainer组件; 公用Form1() { 的InitializeComponent(); } 保护覆盖无效的Dispose(BOOL处置) { 如果(处置) { 如果(components! = NULL) { components.Dispose(); } } base.Dispose(处置); }#region组件 私人无效的InitializeComponent() { this.components =新System.ComponentModel.Container(); this.groupBox1 =新System.Windows.Forms.GroupBox(); this.textBox2 =新System.Windows.Forms.TextBox(); this.textBox1 =新System.Windows.Forms.TextBox(); this.label2 =新System.Windows.Forms.Label(); this.label1 =新System.Windows.Forms.Label(); this.button1 =新System.Windows.Forms.Button(); this.groupBox2 =新System.Windows.Forms.GroupBox(); this.button2 =新System.Windows.Forms.Button(); this.textBox5 =新System.Windows.Forms.TextBox(); this.textBox4 =新System.Windows.Forms.TextBox(); this.textBox3 =新System.Windows.Forms.TextBox(); this.label5 =新System.Windows.Forms.Label(); this.label4 =新System.Windows.Forms.Label(); this.label3 =新System.Windows.Forms.Label(); this.label6 =新System.Windows.Forms.Label(); this.timer1 =新System.Windows.Forms.Timer(this.components); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); / / TextBox1的 this.groupBox1.Controls.Add(this.textBox2); this.groupBox1.Controls.Add(this.textBox1); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.button1); this.groupBox1.Name =“groupBox1”; this.groupBox1.Size =新System.Drawing.Size(288,112); this.groupBox1.TabIndex = 0; this.groupBox1.Text =“ASCII转换”; / / TextBox2中 this.textBox2.Location =新System.Drawing.Point(112,64); this.textBox2.Name =“textBox2中”; this.textBox2.Size =新System.Drawing.Size(80,21); this.textBox2.TabIndex = 3; this.textBox2.Text =“”; / / TextBox1的 this.textBox1.Location =新System.Drawing.Point(112,24); this.textBox1.Name =“textBox1的”; this.textBox1.Size =新System.Drawing.Size(80,21); this.textBox1.TabIndex = 2; this.textBox1.Text =“”; this.textBox1.TextChanged + =新System.EventHandler(this.textBox1_TextChanged); / /标签2 this.label2.Location =新System.Drawing.Point(8,72); this.label2.Name =“标记2”; this.label2.Size =新System.Drawing.Size(72,24); this.label2.TabIndex = 1; this.label2.Text =“ASCII码”; / / Label1的 this.label2.Location =新System.Drawing.Point(8,24); this.label1.Name =“label1的”; this.label1.Size =新System.Drawing.Size(80,24); this.label1.TabIndex = 0; this.label1.Text =“字符”; / / Button1的 this.button1.Location =新System.Drawing.Point(200,40); this.button1.Name =“Button1的”; this.button1.TabIndex = 2; this.button1.Text =“确定”; this.button1.Click + =新System.EventHandler(this.button1_Click); / / groupBox2 this.groupBox2.Controls.Add(this.button2); this.groupBox2.Controls.Add(this.textBox5); this.groupBox2.Controls.Add(this.textBox4); this.groupBox2.Controls.Add(this.textBox3); this.groupBox2.Controls.Add(this.label5); this.groupBox2.Controls.Add(this.label4); this.groupBox2.Controls.Add(this.label3); this.groupBox2.Location =新System.Drawing.Point(24,152); this.groupBox2.Name =“groupBox2”; this.groupBox2.Size =新System.Drawing.Size(288,144); this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = FALSE; this.groupBox2.Text =“数制转换V1.0”; / /按钮2 this.button2.Location =新System.Drawing.Point(208,56); this.button2.Name =“按钮2”; this.button2.TabIndex = 6; this.button2.Text =“确定”; this.button2.Click + =新System.EventHandler(this.button2_Click); / / TextBox5 this.textBox5.Location =新System.Drawing.Point(120,104); this.textBox5.Name =“textBox5”; this.textBox5.Size =新System.Drawing.Size(80,21); this.textBox5.TabIndex = 5; this.textBox5.Text =“”; / / textBox4 this.textBox4.Location =新System.Drawing.Point(120,64); this.textBox4.Name =“textBox4”; this.textBox4.Size =新System.Drawing.Size(80,21); this.textBox4.TabIndex = 4; this.textBox4.Text =“”; / / TextBox3的 this.textBox3.Location =新System.Drawing.Point(120,24); this.textBox3.Name =“TextBox3的”; this.textBox3.Size =新System.Drawing.Size(80,21); this.textBox3.Text =“”; / / label5 this.label5.Location =新System.Drawing.Point(16,112); this.label5.Name =“label15”; this.label5.Size =新System.Drawing.Size(88,24); this.label5.TabIndex = 2; this.label5.Text =“十六进制”; / / Label4的 this.label4.Location =新System.Drawing.Point(16,72); this.label4.Name =“Label4的”; this.label4.Size =新System.Drawing.Size(88,24); this.label4.TabIndex = 1; this.label4.Text =“二进制”; / / LABEL3 this.label3.Location =新System.Drawing.Point(16,24); this.label3.Name =“LABEL3”; this.label3.Size =新System.Drawing.Size(88,24); this.label3.TabIndex = 0; this.label3.Text =“十进制”; / / label6 this.label6.Location =新System.Drawing.Point(88,304); this.label6.Name =“label6”; this.label6.Size =新System.Drawing.Size(208,16); this.label6.TabIndex = 2; / /定时器 this.timer1.Tick + =新System.EventHandler(this.timer1_Tick); this.AutoScaleBaseSize =新System.Drawing.Size(6,14); this.ClientSize =新System.Drawing.Size(342323); this.Controls.Add(this.label6); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Name =“Form1的”; this.Text =“数制转换”; this.Load + =新System.EventHandler(this.Form1_Load); this.groupBox1.ResumeLayout(假); this.groupBox2.ResumeLayout(假); this.ResumeLayout(假); }#endregion 字符串str; [STAThread] 静态无效的主要() { Application.Run(新Form1中()); } 私人无效Form1_Load(对象发件人,发送System.EventArgs) { timer1.Start(); } 无效DateTimeToString() { 现在的DateTime = DateTime.Now; 字符串格式; label6.Text =“”; 格式=“YYYY-MM-DD HH:MM:SS”; label6.Text = now.ToString(格式); } 私人无效的button1_Click(对象发件人,发送System.EventArgs) { 海峡= textBox1.Text; 诠释一个; 如果(str.Length> 1) 的MessageBox.show(“错误,请输入字符!”); 一=(int)的STR [0]; textBox2.Text = a.ToString(); } 私人无效textBox1_TextChanged(对象发件人,发送System.EventArgs) { } 私人无效button2_Click(对象发件人,发送System.EventArgs) { 如果(textBox3.Text!=“”) { T_S(); / /由十进制 - 十六进制 T_Tw(); / /由十进制转二进制 } 否则,如果(textBox4.Text!=“”) { Tw_T(); Tw_S(); } } 无效T_S()/ /十进制转十六进制 { 字符串10; 整型B = 0; 10 = textBox3.Text; 为(int i = 0; I <ten.Length,我+ +) { 诠释三= 1; 为(INT J = ten.Length-I-1,J> 0;的J - ) { C = C * 10; } 如果(十[I]> 57 | | 10 [I] <48) 的MessageBox.show(“输入错误,应输入十进制整数”); 其他 B = B +((int)的十[I] - 48)* C; C = 1; } textBox5.Text = b.ToString(“X8”); } 无效T_Tw()/ /十进制转二进制 { 整型B = 0; 字符串10; 诠释三= 1; 10 = textBox3.Text; 为(int i = 0; I <ten.Length,我+ +) { 为(INT J = ten.Length-I-1,J> 0;的J - ) { C = C * 10; } B = B +((int)的十[I] -48)* C; C = 1; } textBox4.Text = Convert.ToString并(b,2); } 无效Tw_T()/ /二进制转十进制 { 字串2; 2 = textBox4.Text; 整数P = Convert.ToInt32(二,2); textBox3.Text = p.ToString(); } 无效Tw_S()/ /二进制转十六进制 { 字串2; 2 = textBox4.Text; int类型= Convert.ToInt32(二,2); textBox5.Text = s.ToString(“X8”); } 私人无效timer1_Tick(对象发件人,发送System.EventArgs) { DateTimeToString(); } }}
3 0
- c#完成的数制转换器---ShinePans
- 数据结构(二)--栈的应用(数制转换器)
- C#遍历(foreach,...)---ShinePans
- C#栈的实现(数制转换)
- 关于C++和C#选择的问题---ShinePans
- 数制转换器(c语言编写,应用数据结构的栈和队列)
- 【C++运用】(基于控制台)完成3个章节的文字游戏---ShinePans
- 用C#打造自己的实体转换器
- 用C#打造自己的实体转换器
- WPF的简单了解---ShinePans
- JavaDoc的生成规则---ShinePans
- C#-简单计时器(C# ConsoleApp) ---ShinePans
- 数制之间的转换
- 数制的转换
- C语言的数制
- 数制的转换
- 数制的转换
- 计算机系统的数制
- 数组逆序重放
- JavaScript学习笔记(4)
- c函数之【字符串处理函数】
- OpenCV 实践程序1——图片显示及多图片融合
- 如何才能避免成为“工作狂”?
- c#完成的数制转换器---ShinePans
- LeetCodeOJ Two Sum (python)
- 经验分享:10个简单实用的 jQuery 代码片段
- 使用dbms_backup_restore包修改dbname及dbid
- github的常用命令/上传和下载代码
- php中检查服务器问题
- 模板 使用中注意的问题 template<class T>
- 父类子类静态块、游离块、构造方法的执行顺序
- CodeForces 8A Train and Peter (简单模拟题)