91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 49KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-29
  • 語言: C#
  • 標簽: c#??漢諾塔??hannoi??動態??

資源簡介

C#可視化動態漢諾塔實現,盤子移動!vs2010,低版本,新建項目然后把改窗體添加進去即可!

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.Text.Regularexpressions;

namespace?han
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????Graphics?g;//獲得graphic
????????//3個柱子和一個底板
????????Pillar?pillar;
????????Pillar?pillarA;
????????Pillar?pillarB;
????????Pillar?pillarC;
????????//當前disk個數?
????????HanDisk[]?disks;
????????int?disksNum;
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????//初始化界面,柱子等
????????????pillar?=?new?Pillar(““);
????????????pillarA?=?new?Pillar(“A“);
????????????pillarB?=?new?Pillar(“B“);
????????????pillarC?=?new?Pillar(“C“);
????????????disksNum?=?0;
????????????//hd?=?new?HanDisk(this100100100100);?????????????
????????}

????????private?void?Form1_MouseMove(object?sender?MouseEventArgs?e)
????????{
????????????this.textBox1.Text?=?e.X.ToString()?+?“?“?+?e.Y.ToString();
????????}
????????//生成hannoi
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????if?((!IsInt(this.textBox2.Text.ToString()))||(this.textBox2.Text.ToString()==““))
????????????{
????????????????MessageBox.Show(“請輸入不為0的整數“);
????????????????this.textBox2.Text?=?““;
????????????????return;
????????????}
????????????disksNum=Convert.ToInt32(this.textBox2.Text.ToString());
????????????if?(disksNum?==?0)
????????????{
????????????????MessageBox.Show(“請輸入不為0的整數!“);
????????????????return;
????????????}
????????????this.textBox3.Text?=?““;
????????????//去除之前的盤子
????????????if?(disks?!=?null)
????????????{
????????????????if?(disks.Length?!=?0)
????????????????HanDisk.ClearDisks(disks);
????????????????pillarA.ClearAll();
????????????????pillarB.ClearAll();
????????????????pillarC.ClearAll();

????????????}
????????????//批量生成盤子,并加到柱子A上
????????????disks=new?HanDisk[disksNum+1];
????????????int?len=160;//盤子長度
????????????int?lenDece=150/disksNum;//盤子遞減量
????????????int?locy=370;
????????????for?(int?i?=?disksNum;?i?>0;?i--)
????????????{
????????????????//MessageBox.Show(locy.ToString());
????????????????disks[i]?=new?HanDisk(thispillarA.locx-len/2locylen);
????????????????disks[i].id?=i;
????????????????//加到pillaA中
????????????????pillarA.disks.Add(disks[i]);
????????????????len?-=?lenDece;
????????????????locy-=10;
????????????}
????????????pillarA.high?=?disks[1].imageP.Location.Y;
????????}
????????//開始解析hannoi
????????private?void?button2_Click(object?sender?EventArgs?e)
????????{
????????????//HanDisk.MoveDisk(hd?300?300);
????????????Hanoi(disksNumpillarApillarBpillarC);
????????}
????????//繪界面
????????private?void?Form1_Paint(object?sender?PaintEventArgs?e)
????????{
????????????pillar.Paint(this0380100010Color.Gray0);
????????????pillarA.Paint(this

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2012-11-06?18:11??han\
?????目錄???????????0??2012-11-06?18:04??han\bin\
?????目錄???????????0??2012-11-06?22:37??han\bin\Debug\
?????文件???????13312??2012-11-07?12:27??han\bin\Debug\han.exe
?????文件???????30208??2012-11-07?12:27??han\bin\Debug\han.pdb
?????文件???????11600??2012-11-07?12:29??han\bin\Debug\han.vshost.exe
?????文件?????????490??2010-03-17?22:39??han\bin\Debug\han.vshost.exe.manifest
?????目錄???????????0??2012-11-06?18:04??han\bin\Release\
?????文件????????7041??2012-11-07?12:27??han\Form1.cs
?????文件????????6895??2012-11-06?22:15??han\Form1.Designer.cs
?????文件????????5817??2012-11-06?22:15??han\Form1.resx
?????文件????????3665??2012-11-06?18:10??han\hannoi.csproj
?????目錄???????????0??2012-11-06?18:01??han\obj\
?????目錄???????????0??2012-11-06?18:01??han\obj\x86\
?????目錄???????????0??2012-11-07?12:27??han\obj\x86\Debug\
?????文件????????4440??2012-11-06?22:37??han\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件????????6238??2012-11-07?12:27??han\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件?????????272??2012-11-06?22:15??han\obj\x86\Debug\GenerateResource.read.1.tlog
?????文件?????????626??2012-11-06?22:15??han\obj\x86\Debug\GenerateResource.write.1.tlog
?????文件?????????727??2012-11-06?18:10??han\obj\x86\Debug\han.csproj.FileListAbsolute.txt
?????文件???????13312??2012-11-07?12:27??han\obj\x86\Debug\han.exe
?????文件?????????180??2012-11-06?22:15??han\obj\x86\Debug\han.Form1.resources
?????文件???????30208??2012-11-07?12:27??han\obj\x86\Debug\han.pdb
?????文件?????????180??2012-11-06?18:10??han\obj\x86\Debug\han.Properties.Resources.resources
?????文件?????????727??2012-11-07?12:29??han\obj\x86\Debug\hannoi.csproj.FileListAbsolute.txt
?????文件????????7897??2012-11-07?12:27??han\obj\x86\Debug\ResolveAssemblyReference.cache
?????目錄???????????0??2012-11-06?18:01??han\obj\x86\Debug\TempPE\
?????文件?????????484??2012-11-06?18:01??han\Program.cs
?????目錄???????????0??2012-11-06?18:01??han\Properties\
?????文件????????1362??2012-11-06?18:01??han\Properties\AssemblyInfo.cs
?????文件????????2854??2012-11-06?18:01??han\Properties\Resources.Designer.cs
............此處省略3個文件信息

評論

共有 條評論