網路城邦
上一篇 回創作列表 下一篇  字體:
【心得筆記】VB「控制元件整合」解題步驟
2009/01/11 16:41:28瀏覽966|回應0|推薦0

這是我參加「中華民國電腦技能基金會」Visual Basic 2003「試窗程式設計認證」的心得筆記,詳實紀錄每題解題步驟,不僅是我的學習歷程,希望也能對於準備參加這項技能認證的同學,有所助益。

Visual Basic 202試題 程式碼

Private Sub cmdClear_Click()

  Picture1.Cls

End Sub

Private Sub cmdRect_Click()

 If optType(0) = True Then

    Picture1.Line (txtX1, txtY1)-(txtX2, txtY2), , B

  Else

    Picture1.Line (txtX1, txtY1)-(txtX2, txtY2), , BF

 End If

End Sub

Private Sub cmdEnd_Click()

 End

End Sub


Visual Basic 204
試題 程式碼

Private Sub cmdBlack_Click()

  lblTColor.BackColor = 0

  hslColor(0) = 0

  hslColor(1) = 0

  hslColor(2) = 0

  lblColor(0) = 0

  lblColor(1) = 0

  lblColor(2) = 0

End Sub

Private Sub cmdWhite_Click()

  lblTColor.BackColor = 255

  hslColor(0) = 255

  hslColor(1) = 255

  hslColor(2) = 255

  lblColor(0) = 255

  lblColor(1) = 255

  lblColor(2) = 255

End Sub

Private Sub hslColor_Change(Index As Integer)

  lblColor(Index) = hslColor(Index)

  lblTColor.BackColor = RGB(hslColor(0), hslColor(1), hslColor(2))

End Sub


Visual Basic 206
試題 程式碼

Private Sub Form_Load()

  lblVote(0) = 0

  lblVote(1) = 0

End Sub

Private Sub cmdPlus_Click(Index As Integer)

  lblVote(Index) = lblVote(Index) + 1

  Call aa

End Sub

Private Sub cmdMinus_Click(Index As Integer)

  If Val(lblVote(Index)) > 0 Then

     lblVote(Index) = lblVote(Index) - 1

  End If

  Call aa

End Sub

If lblVote(0) = lblVote(1) Then

     picSmile(0).Visible = True

     picCry(0).Visible = False

     picSmile(1).Visible = True

     picCry(1).Visible = False

  End If

Private Sub aa()

  If lblVote(0) < lblVote(1) Then

     picSmile(0).Visible = False

     picCry(0).Visible = True

     picSmile(1).Visible = True

     picCry(1).Visible = False

  End If

   If lblVote(0) > lblVote(1) Then

     picSmile(0).Visible = True

     picCry(0).Visible = False

     picSmile(1).Visible = False

     picCry(1).Visible = True

  End If

End Sub


Visual Basic 208
試題 程式碼

Dim n

Private Sub Form_Load() '初始值

  n = 1

End Sub

Private Sub cmdLarge_Click() '放大

  imgBird.Width = imgBird.Width * 1.1

  imgBird.Height = imgBird.Height * 1.1

  imgBird.Left = imgBird.Left - imgBird.Width / 20

  imgBird.Top = imgBird.Top - imgBird.Height / 20

End Sub

Private Sub cmdSmall_Click() '縮小

  imgBird.Width = imgBird.Width * 0.9

  imgBird.Height = imgBird.Height * 0.9

  imgBird.Left = imgBird.Left + imgBird.Width / 20

  imgBird.Top = imgBird.Top + imgBird.Height / 20

End Sub

Private Sub cmdNext_Click() '下一張

  n = n + 1

  If n = 7 Then n = 1

  imgBird = LoadPicture("PRD02-" & n & ".bmp")

End Sub

Private Sub cmdPrevious_Click() '上一張

  n = n - 1

  If n = 0 Then n = 6

  imgBird = LoadPicture("PRD02-" & n & ".bmp")

End Sub

Private Sub cmdEnd_Click() '結束

  End

End Sub


Visual Basic 210
試題 程式碼

Dim cmdAdd1(5) As CommandButton

Dim i As Integer

Private Sub cmdAdd_Click(Index As Integer)

  i = i + 1

  If i > 5 Then

     MsgBox "只能新增五個", , "注意"

     Exit Sub

  End If

  Set cmdAdd1(i) = Controls.Add("vb.commandbutton", "cmdAdd1" & i)

  cmdAdd1(i).Visible = True

  cmdAdd1(i).Caption = i

  cmdAdd1(i).Left = 3000 - 500 * i

  cmdAdd1(i).Top = 3000 - 500 * i

End Sub

》》》延伸閱讀  

基本控制元件控制元件整合返回首頁

( 心情隨筆校園筆記 )
回應 列印 加入我的文摘
上一篇 回創作列表 下一篇

引用
引用網址:https://classic-blog.udn.com/article/trackback.jsp?uid=th1001&aid=2556126