English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

請問要如何寫出9*9,81格顯示數字1~81 不重複

2006-05-25 19:08:00 · 1 個解答 · 發問者 伯晉 2 in 電腦與網際網路 程式設計

1 個解答

Private Sub Form_Activate()        Dim X&, Y&, W&, H&, A(1 To 81) As Boolean, N%                        W = (ScaleWidth - 30) \ 9        H = (ScaleHeight - 30) \ 9        AutoRedraw = True        Cls        Randomize        For X = 0 To 8 * W Step W            For Y = 0 To 8 * H Step H                Line (X, Y)-(X + W, Y + H), , B                Do                  N = Int(Rnd * 81 + 1)                Loop Until A(N) = False                A(N) = True                CurrentX = ((2 * X + W) - TextWidth(CStr(N))) \ 2                CurrentY = ((2 * Y + H) - TextHeight(CStr(N))) \ 2                Print N            Next        Next        AutoRedraw = FalseEnd SubPrivate Sub Form_Click()        Form_ActivateEnd Sub

2006-05-25 20:43:11 · answer #1 · answered by W.J.S. 7 · 0 0

fedest.com, questions and answers