C#汉诺塔演示和代码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
汉诺塔的演示界面:
本系统显示的是汉诺塔的演示效果,分别有播放,暂停,和停止,右边显示的是每一步的动作,同时记录操作次数,可以调节演示的速度。
汉诺塔界面代码:
namespace honio4
{
partial class Form1
{
///
/// 必需的设计器变量。
///
ponentModel.IContainer components = null;
///
/// 清理所有正在使用的资源。
///
/// 如果应释放托管资源,为true;否则为false。
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
///
/// 设计器支持所需的方法- 不要
/// 使用代码编辑器修改此方法的内容。
///
private void InitializeComponent()
{
ponents = new ponentModel.Container();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
bel1 = new bel();
this.udLevels = new System.Windows.Forms.NumericUpDown();
this.btnStart = new System.Windows.Forms.Button();
this.btnPause = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button();
bel2 = new bel();
this.trackSpeed = new System.Windows.Forms.TrackBar();
bel3 = new bel();
this.progress = new System.Windows.Forms.ProgressBar();
this.tmrPlay = new System.Windows.Forms.Timer(ponents);
this.listBox1 = new System.Windows.Forms.ListBox();
bel4 = new bel();
bel5 = new bel();
bel6 = new bel();
bel7 = new bel();
bel8 = new bel();
((ponentModel.ISupportInitialize)(this.udLevels)).BeginInit();
((ponentModel.ISupportInitialize)(this.trackSpeed)).BeginInit(); this.SuspendLayout();
//
// panel1
//
this.panel1.Location = new System.Drawing.Point(16, 16);
= "panel1";
this.panel1.Size = new System.Drawing.Size(96, 144);
this.panel1.TabIndex = 7;
this.panel1.Paint += new
System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
//
// panel2
//
this.panel2.Location = new System.Drawing.Point(136, 16);
= "panel2";
this.panel2.Size = new System.Drawing.Size(96, 144);
this.panel2.TabIndex = 8;
this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint);
//
// panel3
//
this.panel3.Location = new System.Drawing.Point(256, 16);
= "panel3";
this.panel3.Size = new System.Drawing.Size(96, 144);
this.panel3.TabIndex = 8;
this.panel3.Paint += new System.Windows.Forms.PaintEventHandler(this.panel3_Paint);
//
// label1
//
bel1.Location = new System.Drawing.Point(16, 168);
= "label1";
bel1.Size = new System.Drawing.Size(42, 21);
bel1.TabIndex = 1;
bel1.Text = "层数:";
bel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// udLevels
//
this.udLevels.Location = new System.Drawing.Point(51, 166);
this.udLevels.Maximum = new decimal(new int[] {
5,
0,
0,
0});
this.udLevels.Minimum = new decimal(new int[] {
1,
0,
0,
0});
= "udLevels";
this.udLevels.Size = new System.Drawing.Size(32, 21);