資源簡介
一個基于C#編寫的剪刀石頭布的小游戲,適合于教學用,適合于初學者學習用

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
namespace?SX4_3
{
????public?partial?class?MainForm?:?Form
????{
????????int?intMyScore;//我贏的局數
????????int?intComputerScore;//電腦贏的局數
????????bool?blReady;?//開始按鈕的狀態
????????int?intMySelect;?//我每次的選擇
????????int?intComputerSelect;?//電腦每次的選擇
????????int?intTotal;?//總局數
????????public?MainForm()
????????{
????????????InitializeComponent();
????????}
????????private?void?MainForm_Load(object?sender?EventArgs?e)
????????{
????????????blReady?=?true;
????????????if?(blReady)
????????????{
????????????????this.btnComputer1.Visible?=?false;
????????????????this.btnComputer2.Visible?=?false;
????????????????this.btnComputer3.Visible?=?false;
????????????????this.btnMy1.Visible?=?false;
????????????????this.btnMy2.Visible?=?false;
????????????????this.btnMy3.Visible?=?false;
????????????????this.lblResult.Visible?=?false;
????????????????intMyScore?=?0;
????????????????intComputerScore?=?0;
????????????????this.lblComputer.Text?=?(intTotal).ToString()?+?“局“?+?intComputerScore.ToString()?+?“勝“;
????????????????this.lblMy.Text?=?(intTotal).ToString()?+?“局“?+?intMyScore.ToString()?+?“勝“;
????????????????this.btnStart.Text?=?“開始“;
????????????????intMySelect=-1;
????????????????intComputerSelect=-1;
????????????????intTotal=0;
????????????}
????????}
????????private?void?btnStart_Click(object?sender?EventArgs?e)
????????{
????????????if?(blReady)
????????????{
????????????????this.btnStart.Text?=?“再來一次“;
????????????????this.btnMy1.Visible?=?true;
????????????????this.btnMy2.Visible?=?true;
????????????????this.btnMy3.Visible?=?true;
????????????????this.lblResult.Visible?=?false;
????????????????blReady?=?false;
????????????}
????????????else
????????????{
????????????????this.btnComputer1.Visible?=?false;
????????????????this.btnComputer2.Visible?=?false;
????????????????this.btnComputer3.Visible?=?false;
????????????????this.btnMy1.Visible?=?false;
????????????????this.btnMy2.Visible?=?false;
????????????????this.btnMy3.Visible?=?false;
????????????????this.lblResult.Visible?=?false;
????????????????this.lblComputer.Text?=?(intMyScore?+?intComputerScore).ToString()?+?“局“?+?intComputerScore.ToString()?+?“勝“;
????????????????this.lblComputer.Text?=?(intMyScore?+?intComputerScore).ToString()?+?“局“?+?intMyScore.ToString()?+?“勝“;
????????????????this.btnStart.Text?=?“開始“;
????????????????blReady?=?true;
????????????}
????????}
????????private?void?btnMy1_Click(object?sender?EventArgs?e)
????????{
????????????intMySelect?=?1;
????????????btnMy2.Visible?=?false;
????????????btnMy3.Visible?=?false;
????????????btnComputer1.Visible?=?true;
????????????btnComputer2.Visible?=?true;
????????????btnComputer3.Visible?=?true;
????????????ComputerAutoSelect();
????????}
????????private?void?btnMy2_Click(object?sender?E
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2012-08-30?19:28??SX4-3\
?????目錄???????????0??2012-08-30?19:28??SX4-3\bin\
?????目錄???????????0??2012-08-30?19:28??SX4-3\bin\Debug\
?????文件??????208896??2010-05-11?15:58??SX4-3\bin\Debug\SX4-3.exe
?????文件???????28160??2010-05-11?15:58??SX4-3\bin\Debug\SX4-3.pdb
?????文件???????11608??2011-10-13?07:58??SX4-3\bin\Debug\SX4-3.vshost.exe
?????文件?????????490??2010-03-17?22:39??SX4-3\bin\Debug\SX4-3.vshost.exe.manifest
?????目錄???????????0??2011-09-29?10:07??SX4-3\bin\Release\
?????文件????????6816??2010-05-11?15:58??SX4-3\MainForm.cs
?????文件???????12423??2010-04-19?15:19??SX4-3\MainForm.Designer.cs
?????文件??????281228??2009-09-19?19:14??SX4-3\MainForm.resx
?????目錄???????????0??2012-08-30?19:28??SX4-3\obj\
?????目錄???????????0??2012-08-30?19:28??SX4-3\obj\Debug\
?????文件????????5481??2011-09-29?10:07??SX4-3\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????目錄???????????0??2011-06-16?06:43??SX4-3\obj\Debug\Refactor\
?????文件?????????242??2011-10-13?07:58??SX4-3\obj\Debug\SX4-3.csproj.FileListAbsolute.txt
?????文件?????????845??2010-04-19?15:15??SX4-3\obj\Debug\SX4-3.csproj.GenerateResource.Cache
?????文件??????208896??2010-05-11?15:58??SX4-3\obj\Debug\SX4-3.exe
?????文件???????28160??2010-05-11?15:58??SX4-3\obj\Debug\SX4-3.pdb
?????文件??????184320??2010-04-19?15:17??SX4-3\obj\Debug\SX4_3.MainForm.resources
?????文件?????????180??2010-04-19?15:15??SX4-3\obj\Debug\SX4_3.Properties.Resources.resources
?????目錄???????????0??2012-08-30?19:28??SX4-3\obj\Debug\TempPE\
?????文件????????4608??2011-09-29?10:07??SX4-3\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
?????文件?????????971??2010-10-25?08:02??SX4-3\obj\SX4-3.csproj.FileListAbsolute.txt
?????文件?????????467??2010-04-19?15:17??SX4-3\Program.cs
?????目錄???????????0??2012-08-30?19:28??SX4-3\Properties\
?????文件????????1174??2010-04-19?15:12??SX4-3\Properties\AssemblyInfo.cs
?????文件????????2848??2011-09-29?10:07??SX4-3\Properties\Resources.Designer.cs
?????文件????????5612??2010-04-19?15:12??SX4-3\Properties\Resources.resx
?????文件????????1103??2011-09-29?10:07??SX4-3\Properties\Settings.Designer.cs
?????文件?????????249??2010-04-19?15:12??SX4-3\Properties\Settings.settings
............此處省略2個文件信息
- 上一篇:操作系統進程管理系統課程設計C#
- 下一篇:c# chart控件實時顯示曲線
評論
共有 條評論