Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. Public Class PushBtn
  2.     '列舉類型
  3.     Dim PB_state As Boolean = False '沒按
  4.     '-----Get PB_state-----
  5.     Property _PB_state() As Boolean
  6.         Get
  7.             Return Me.PB_state
  8.         End Get
  9.         Set(value As Boolean)   '
  10.             If value = False Then
  11.                 PB_state = value '沒按
  12.                 Button1.Image = My.Resources.gold_button_hover_md
  13.             Else
  14.                 PB_state = value '按下
  15.                 Button1.Image = My.Resources.gold_button_md
  16.             End If
  17.         End Set
  18.     End Property
  19.  
  20.     '按鈕按下動作的處理
  21.     Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
  22.         If PB_state = False Then
  23.             Me._PB_state = True
  24.         Else
  25.             Me._PB_state = False
  26.         End If
  27.     End Sub
  28. End Class