返回列表 上一主題 發帖

[原創] vb2010 陣列顯示的結果...

[原創] vb2010 陣列顯示的結果...

本帖最後由 mark15jill 於 2012-12-5 17:29 編輯

vb2010 可以這樣做..
其他版本請自行研究
純屬好玩...(其實是 陣列還沒搞好ˇˇ
  1. Public Class Form1
  2.     Dim chbo1(97, 56) As CheckBox

  3.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

  4.         Dim usx1, usy1 As Integer
  5.         Dim nn As Integer


  6.         Dim fontFamily As New FontFamily("微軟正黑體")
  7.         Me.Show()

  8.         nn = 1

  9.         For usx1 = 0 To 97
  10.             For usy1 = 0 To 56
  11.                 chbo1(usx1, usy1) = New CheckBox
  12.                 chbo1(usx1, usy1).BackColor = Color.Aquamarine
  13.                 chbo1(usx1, usy1).Width = 20
  14.                 chbo1(usx1, usy1).Height = 20
  15.                 chbo1(usx1, usy1).Appearance = Appearance.Button
  16.                 chbo1(usx1, usy1).TextAlign = ContentAlignment.MiddleCenter
  17.                 chbo1(usx1, usy1).Font = New Font(fontFamily, 14, FontStyle.Regular, GraphicsUnit.Pixel)
  18.                 chbo1(usx1, usy1).Location = New Point((15 * usx1), (15 * usy1))
  19.                 Me.Controls.Add(chbo1(usx1, usy1))
  20.                 'chbo1(usx1, usy1).Text = chbo1(usx1, usy1).Name & "第一區塊" & Chr(10) & Chr(10) & nn
  21.                 nn = nn + 1
  22.             Next
  23.         Next


  24.         '分隔線'


  25.         usx1 = Nothing
  26.         usy1 = Nothing

  27.     End Sub
  28. End Class
複製代碼

  多做多想多學習,少看少錯少迷途

  多做=多多練習,多多編寫。
  多想=想想為什麼人家程式要那樣寫,如果換成自己,又會怎寫。
  多學習=學習人家的發問並解答,學習人家的寫法

  少看=只看不做也枉然

        靜思自在 : 【停滯不前,終無所得】人都迷於尋找奇蹟,因而停滯不前;縱使時間再多、路再長,也了無用處,終無所得。
返回列表 上一主題