asp.net实现“九连环”小游戏

浏览:42日期:2023-04-22
public Class ChinaRing1Inherits System.Web.UI.Page#Region " Web 窗体设计器生成的代码 "'该调用是 Web 窗体设计器所必需的。<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()End SubProtected WithEvents ChinaRingCkBox1 As System.Web.UI.WebControls.CheckBoxProtected WithEvents ChinaRingCkBox2 As System.Web.UI.WebControls.CheckBoxProtected WithEvents ChinaRingCkBox3 As System.Web.UI.WebControls.CheckBoxProtected WithEvents ChinaRingCkBox4 As System.Web.UI.WebControls.CheckBoxProtected WithEvents ChinaRingCkBox5 As System.Web.UI.WebControls.CheckBoxProtected WithEvents ChinaRingCkBox6 As System.Web.UI.WebControls.CheckBoxProtected WithEvents ChinaRingCkBox7 As System.Web.UI.WebControls.CheckBoxProtected WithEvents ChinaRingCkBox8 As System.Web.UI.WebControls.CheckBoxProtected WithEvents ChinaRingCkBox9 As System.Web.UI.WebControls.CheckBoxProtected WithEvents ChinaRingLb1 As System.Web.UI.WebControls.LabelProtected ChinaRingCkBox(8) As System.Web.UI.WebControls.CheckBox'注意: 以下占位符声明是 Web 窗体设计器所必需的。'不要删除或移动它。Private designerPlaceholderDeclaration As System.ObjectPrivate Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init'CODEGEN: 此方法调用是 Web 窗体设计器所必需的'不要使用代码编辑器修改它。InitializeComponent()End Sub#End RegionPrivate Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadChinaRingCkBox(0) = ChinaRingCkBox1ChinaRingCkBox(1) = ChinaRingCkBox2ChinaRingCkBox(2) = ChinaRingCkBox3ChinaRingCkBox(3) = ChinaRingCkBox4ChinaRingCkBox(4) = ChinaRingCkBox5ChinaRingCkBox(5) = ChinaRingCkBox6ChinaRingCkBox(6) = ChinaRingCkBox7ChinaRingCkBox(7) = ChinaRingCkBox8ChinaRingCkBox(8) = ChinaRingCkBox9End SubPrivate Sub ChinaRingCkBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChinaRingCkBox1.CheckedChangedChinaRingCkBox_CheckedChanged(1, sender, e)End SubPrivate Sub ChinaRingCkBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChinaRingCkBox2.CheckedChangedChinaRingCkBox_CheckedChanged(2, sender, e)End SubPrivate Sub ChinaRingCkBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChinaRingCkBox3.CheckedChangedChinaRingCkBox_CheckedChanged(3, sender, e)End SubPrivate Sub ChinaRingCkBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChinaRingCkBox4.CheckedChangedChinaRingCkBox_CheckedChanged(4, sender, e)End SubPrivate Sub ChinaRingCkBox5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChinaRingCkBox5.CheckedChangedChinaRingCkBox_CheckedChanged(5, sender, e)End SubPrivate Sub ChinaRingCkBox6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChinaRingCkBox6.CheckedChangedChinaRingCkBox_CheckedChanged(6, sender, e)End SubPrivate Sub ChinaRingCkBox7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChinaRingCkBox7.CheckedChangedChinaRingCkBox_CheckedChanged(7, sender, e)End SubPrivate Sub ChinaRingCkBox8_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChinaRingCkBox8.CheckedChangedChinaRingCkBox_CheckedChanged(8, sender, e)End SubPrivate Sub ChinaRingCkBox9_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChinaRingCkBox9.CheckedChangedChinaRingCkBox_CheckedChanged(9, sender, e)End SubPrivate Sub ChinaRingCkBox_CheckedChanged(ByVal index As Integer, ByVal sender As System.Object, ByVal e As System.EventArgs)Dim i As Integeri = 0Dim ChinaRingCk As Boolean = FalseIf index = 1 ThenChinaRingCk = TrueElseIf ChinaRingCkBox(index - 2).Checked ThenChinaRingCk = TrueEnd IfDo While i < index - 2If ChinaRingCkBox(i).Checked ThenChinaRingCk = FalseEnd Ifi = i + 1LoopEnd IfIf Not ChinaRingCk ThenChinaRingCkBox(index - 1).Checked = Not ChinaRingCkBox(index - 1).Checked'可以在这里加一个提示,根据条件提示不能套入,或不能拿出该环。End IfEnd SubEnd Class
相关文章: