这是我用做的 中心思想一样,你看看,看不了,再告诉我。
邮箱:wangluobaobin@
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写处置以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As
'注意:以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents lblMsg As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.lblMsg = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'lblMsg
'
Me.lblMsg.Font = New System.Drawing.Font("KaiTi_GB2312", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.lblMsg.ForeColor = System.Drawing.Color.Purple
Me.lblMsg.Location = New System.Drawing.Point(19, 17)
Me.lblMsg.Name = "lblMsg"
Me.lblMsg.Size = New System.Drawing.Size(259, 95)
Me.lblMsg.TabIndex = 0
Me.lblMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(300, 147)
Me.Controls.Add(Me.lblMsg)
Me.Name = "Form1"
Me.Text = "解鸡兔同笼问题"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ji, tu As Integer
For ji = 0 To 35
For tu = 0 To 35
If ji + tu = 35 And 2 * ji + 4 * tu = 94 Then
lblMsg.Text = "笼中有鸡 " + CStr(ji) + " 只" + Chr(13) + Chr(10)
lblMsg.Text = lblMsg.Text + "笼中有兔 " + CStr(tu) + " 只"
End If
Next
Next
Dim ji, tu As Integer
For ji = 0 To 35
tu = 35 - ji
If 2 * ji + 4 * tu = 94 Then
lblMsg.Text = "笼中有鸡 " + CStr(ji) + " 只" + Chr(13) + Chr(10)
lblMsg.Text = lblMsg.Text + "笼中有兔 " + CStr(tu) + " 只"
End If
Next
End Sub
Private Sub lblMsg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblMsg.Click
End Sub
End Class