玩了很多河內塔遊戲
想試試看自己用VB6.0寫出來
QQ但是
完全摸不著頭緒阿
在知識中有河內塔的程式
但是那是C語言完完全全看不懂
可以請各位大大教一下嗎?
2006-04-27 11:32:32 · 4 個解答 · 發問者 蜥蜴 1 in 電腦與網際網路 ➔ 程式設計
我一年級><
可不可以註解一下看不懂。。。。
2006-04-27 14:54:09 · update #1
Dim K(4), C(2), S(2), N%, V%, W%, H%, Q%, P%, B%Private Sub Form_Load()Dim I%, R%Width = 7800Height = 3300AutoRedraw = 1DrawStyle = 3Q = 2200P = 300R = PFor I = 0 To 2 C(I) = R Line (R, P)-(R + Q, P + Q), , B R = R + P + QNextR = Q - PFor I = 4 To 0 Step -1 Set K(I) = Controls.Add("Vb.Shape", "K" & I) With K(I) .Left = (Q - R) / 2 + P: .Top = (Q - R) / 2 + P: .Height = R: .Width = R: .Visible = 1 .Shape = 1: .FillStyle = 0: .FillColor = QBColor(I + 1): .ZOrder End With S(0) = I & "," & S(0) R = R - PNextEnd SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)Dim I%, J%B = 0If Button = 1 Then For I = 0 To 2 If X > C(I) And X < C(I) + Q Then If Y > P And Y < Q Then Exit For End If Next If I < 3 Then If S(I) <> "" Then J = InStr(S(I), ",") N = Left(S(I), J - 1) If X > K(N).Left And X < K(N).Left + K(N).Width Then If Y > K(N).Top And Y < K(N).Top + K(N).Height Then W = X H = Y B = 1 V = I If J = Len(S(I)) Then S(I) = "" Else S(I) = Mid(S(I), J + 1) End If End If End If End If End IfEnd IfEnd SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)If Button = 1 And B Then K(N).Move K(N).Left + X - W, K(N).Top + Y - H W = X: H = YEnd IfEnd SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)Dim I%If Button = 1 And B Then For I = 0 To 2 If X > C(I) And X < C(I) + Q Then If Y > P And Y < Q Then Exit For End If Next If I > 2 Then I = V Else If S(I) <> "" Then If Int(Left(S(I), InStr(S(I), ",") - 1)) < N Then I = V End If End If K(N).Move (Q - K(N).Width) / 2 + C(I), (Q - K(N).Height) / 2 + P S(I) = N & "," & S(I) B = 0End IfEnd Sub
2006-05-01 11:35:44 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋
大大可以敎一下媽^^
2006-04-27 15:57:07 · answer #2 · answered by 蜥蜴 1 · 0⤊ 0⤋
http://myweb.hinet.net/home9/afuchai/VB/Hanoi.exe
2006-04-27 15:53:36 · answer #3 · answered by ? 6 · 0⤊ 0⤋
你幾年級
我三年級而以這麼簡單
(f1)+)(01)= 001
go;krm kt; knr ql;n pqn pn
eo ]rn[w
rjqo [
2006-04-27 12:43:07 · answer #4 · answered by 小賀 1 · 0⤊ 0⤋