ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[­ì³Ð] Visual Base 2010 °}¦Cµ²ªG Part 2

[­ì³Ð] Visual Base 2010 °}¦Cµ²ªG Part 2

µ{¦¡»¡©ú
»¡©ú1.¦¹¬°¤j½d³ò°}¦C°Ï°ì©MCombobox ¹ïÀ³Ãö«Y¡A¦ý¥²¶·¥ý·s¼W Combobox ©M Label ¦U¤@­Ó¡C
»¡©ú2.³o­Óµ{¦¡¥iÀ³¥Î©óÀɮ׬[ºÞ²z¡B¾÷©Ð°t¸mªí¡C
»¡©ú3.­Y¦³°ÝÃD¥i¥H¸ß°Ý¡A¦ý¤£¥Nªí§Ú¥þ·|~

°õ¦æµ²ªG¹Ï¤ù

°}¦C´ú¸Õ-²Ä¤@°Ï¶ô.jpg
2012-12-10 15:58

°}¦C´ú¸Õ-²Ä29°Ï¶ô.jpg
2012-12-10 16:01

µ{¦¡½X°Ï°ì
  1. Public Class Form1
  2.     Dim bubo1(25, 4) As Button
  3.     Dim chcom As ComboBox
  4.     Dim labcom As Label
  5.     Private Sub Form1_Invalidated(ByVal sender As Object, ByVal e As System.Windows.Forms.InvalidateEventArgs) Handles Me.Invalidated
  6.         With Me
  7.             .Height = 900
  8.             .Width = 1650
  9.         End With
  10.     End Sub
  11.     Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated

  12.         Dim usx1, usy1 As Integer
  13.         Dim nn As Integer

  14.         chcom = Me.ComboBox1


  15.         Dim fontFamily As New FontFamily("·L³n¥¿¶ÂÅé")
  16.         Me.Show()

  17.         nn = 1
  18.         For usx1 = 0 To 25
  19.             For usy1 = 0 To 4

  20.                 bubo1(usx1, usy1) = New button
  21.                 Me.Controls.Add(bubo1(usx1, usy1))

  22.                 bubo1(usx1, usy1).BackColor = Color.Aquamarine
  23.                 bubo1(usx1, usy1).Width = 37
  24.                 bubo1(usx1, usy1).Height = 150
  25.                 bubo1(usx1, usy1).AutoSize = False
  26.                 bubo1(usx1, usy1).TextAlign = ContentAlignment.MiddleCenter ' ¤W¤U¥ª¥k¸m¤¤
  27.                 bubo1(usx1, usy1).Font = New Font(fontFamily, 12, FontStyle.Regular, GraphicsUnit.Pixel) ' ¦rÅé¡B¤j¤p¡BÃþ«¬
  28.                 bubo1(usx1, usy1).Location = New Point(10 + (43 * usx1), 10 + (155 * usy1))
  29.                 'bubo1(usx1, usy1).Appearance = Appearance.Button '«ö¶s«¬ºA
  30.                 bubo1(usx1, usy1).Text = bubo1(usx1, usy1).Name & "²Ä O °Ï°ì" & Chr(10) & "²Ä" & " " & nn & " " & "°Ï¶ô"

  31.                 '¤À¹j½u'
  32.                 chcom.Items.Add(bubo1(usx1, usy1).Text)

  33.                 nn = nn + 1
  34.             Next
  35.         Next


  36.         usx1 = Nothing
  37.         usy1 = Nothing

  38.     End Sub


  39.     Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
  40.         labcom = Me.Label1
  41.         'labcom.Text = Me.chcom.Text

  42.         If Me.chcom.Text <> "" Then
  43.             'MsgBox(Me.chcom.Text) '& Chr(10) & Me.bubo1(25, 4).Text)   
  44.             If (InStr(Me.chcom.Text, "¶ô") >= 1) Then
  45.                 'MsgBox(Me.chcom.Text & Chr(10) & "¦b²Ä" & InStr(Me.chcom.Text, "¶ô") & "¦ì") '& Chr(10) & Mid(Me.chcom.Text, 10, 1))
  46.             End If
  47.             For aaa = 1 To 2
  48.                 For usx1 = 0 To 25
  49.                     For usy1 = 0 To 4
  50.                         If bubo1(usx1, usy1).Text = Me.chcom.Text Then
  51.                             labcom.Text = bubo1(usx1, usy1).Text
  52.                             bubo1(usx1, usy1).BackColor = Color.DarkSalmon
  53.                         ElseIf bubo1(usx1, usy1).Text <> Me.chcom.Text Then
  54.                             bubo1(usx1, usy1).BackColor = Color.Aquamarine
  55.                         End If
  56.                     Next
  57.                 Next
  58.             Next
  59.         End If

  60.     End Sub


  61. End Class
½Æ»s¥N½X

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

°}¦C±±¨î¶µ²£¥Í...¦³½ì

TOP

        ÀR«ä¦Û¦b : ¦³¤ß´N¦³ºÖ¡A¦³Ä@´N¦³¤O¡A¦Û³yºÖ¥Ð¡A¦Û±oºÖ½t¡C
ªð¦^¦Cªí ¤W¤@¥DÃD