Contents ...
udn網路城邦
vb6.0圖形化結帳系統
2008/12/25 14:28
瀏覽1,190
迴響0
推薦1
引用0

Dim s As Integer   '總價
Dim flag(4) As Boolean  '是否有放置物品

Private Sub Form_Load()   '初始設定
For i = 0 To 4
   flag(i) = False
Next i
End Sub

Private Sub Image1_DragOver(Index As Integer, Source As Control, X As Single, Y As Single, State As Integer)
If flag(Index) = False Then           '未放置物品
   If Source.Name = "Image2" Then     '放入image2
      Image1(Index).Picture = Image2.Picture
      s = s + 10
   End If
   If Source.Name = "Image3" Then     '放入image3
      Image1(Index).Picture = Image3.Picture
      s = s + 20
   End If
   If Source.Name = "Image4" Then     '放入image4
      Image1(Index).Picture = Image4.Picture
      s = s + 30
   End If
  Label1.Caption = s   '輸出總價
  flag(Index) = True   '設為已放物品
End If
End Sub

有誰推薦more
發表迴響

會員登入