VB~~用SHAPE做的東西

我\'想問...用一個shape

有四格控制鈕

分別為上移下移左移又移

接者每案一次他就移動一次和變一次顏色

然後用用一個控制鈕

讓球可以碰到牆壁就彈回來

一碰到就彈!!除非我案stop

Update:

你誤解了...

我所說得案一次就變一次顏色不是單單那種顏色

而是...美案一次各變一次顏色@@!!

而且!!還要在另設一個COMMAND5

讓SHAPE可以自己動!但是碰到牆壁就會彈回來

不過還是謝謝你@@!

1 Answer

Rating
  • 1 decade ago
    Favorite Answer

    '移動Shape並更改顏色

    Private Sub Form_Load()

    Shape1.FillStyle = 0

    End Sub

    Private Sub Command1_Click()

    Shape1.Top = Shape1.Top - 50

    Shape1.FillColor = &HC0FFFF

    End Sub

    Private Sub Command2_Click()

    Shape1.Top = Shape1.Top + 50

    Shape1.FillColor = &HC0C0FF

    End Sub

    Private Sub Command3_Click()

    Shape1.Left = Shape1.Left - 50

    Shape1.FillColor = &HC0FFC0

    End Sub

    Private Sub Command4_Click()

    Shape1.Left = Shape1.Left + 50

    Shape1.FillColor = &HC0C0&

    End Sub

    2006-05-07 00:29:05 補充:

    要案一次就變一次顏色的話用亂數決定就可以了至於讓SHAPE碰到牆壁就會反彈是指像打磚塊嗎?可以用Shape.Top和Shape.lLeft判斷是否碰到牆壁不會很難,自己想才會有收穫

    Source(s): 自己
Still have questions? Get your answers by asking now.