請問圖片要如何向下移動?? |
尚未結案
|
kennan8176
一般會員 發表:8 回覆:9 積分:3 註冊:2005-04-11 發送簡訊給我 |
以下是圖片動作是按Botton向左移動20pixel
但是我想改成向下移動..可是都改不成功..
請問高手們要如何改呢??? 以下是圖片動作是按Botton向左移動20pixel
但是我想改成向下移動..可是都改不成功..
請問高手們要如何改呢??? Dim n, i As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If picRunner.Location.X > -(picRunner.Width) Then
picRunner.Location = New Point(picRunner.Location.X - 20, 130) Else
picRunner.Location = New Point(Me.Width, 130)
End If
i = 1 '要記得累加
End Sub Private Sub Form4_1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
pic4.Visible = False
picRunner.Location = New Point(Me.Width, 130)
picRunner.Image = pic4.Image
n = n 1
End Sub 發表人 - kennan8176 於 2005/06/02 17:08:59
|
kartan_01
一般會員 發表:42 回覆:60 積分:20 註冊:2004-12-08 發送簡訊給我 |
Dim n, i As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If picRunner.Location.X > -(picRunner.Width) Then //picRunner.Location.Y > -(picRunner.Height) picRunner.Location = New Point(picRunner.Location.X - 20, 130) //New Point(130 , picRunner.Location.Y - 20) Else
picRunner.Location = New Point(Me.Width, 130) //picRunner.Location = New Point(130,Me.Height) End If
i = 1 '要記得累加
End Sub Private Sub Form4_1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
pic4.Visible = False picRunner.Location = New Point(Me.Width, 130) //picRunner.Location = New Point(130,Me.Height) picRunner.Image = pic4.Image
n = n 1 End Sub
|
kennan8176
一般會員 發表:8 回覆:9 積分:3 註冊:2005-04-11 發送簡訊給我 |
這樣結果是往上移動說...
怎麼調整都無法往下移動內......怎麼會這樣哪裡出錯了呢???
引言: Dim n, i As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If picRunner.Location.X > -(picRunner.Width) Then //picRunner.Location.Y > -(picRunner.Height) picRunner.Location = New Point(picRunner.Location.X - 20, 130) //New Point(130 , picRunner.Location.Y - 20) Else picRunner.Location = New Point(Me.Width, 130) //picRunner.Location = New Point(130,Me.Height) End If i = 1 '要記得累加 End Sub Private Sub Form4_1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load pic4.Visible = False picRunner.Location = New Point(Me.Width, 130) //picRunner.Location = New Point(130,Me.Height) picRunner.Image = pic4.Image n = n 1 End Sub |
kartan_01
一般會員 發表:42 回覆:60 積分:20 註冊:2004-12-08 發送簡訊給我 |
|
kennan8176
一般會員 發表:8 回覆:9 積分:3 註冊:2005-04-11 發送簡訊給我 |
|
sham1980
一般會員 發表:17 回覆:14 積分:6 註冊:2005-05-10 發送簡訊給我 |
'我並未做碰到底則停止的判斷,不過這應該是不難吧,你再試試吧,祝順心。
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'向左移動
If picRunner.Location.X > -(picRunner.Width) Then
picRunner.Location = New Point(picRunner.Location.X - 20, 130)
Else
picRunner.Location = New Point(Me.Width, 130)
End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
'向右
If picRunner.Location.X > -(picRunner.Width) Then
picRunner.Location = New Point(picRunner.Location.X 20, 130)
Else
picRunner.Location = New Point(Me.Width, 130)
End If
End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
'向上
If picRunner.Location.X > -(picRunner.Width) Then
picRunner.Location = New Point(picRunner.Location.X, picRunner.Location.Y - 20)
Else
picRunner.Location = New Point(Me.Width, 130)
End If
End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
'向下
If picRunner.Location.X > -(picRunner.Width) Then
picRunner.Location = New Point(picRunner.Location.X, picRunner.Location.Y 20)
Else
picRunner.Location = New Point(Me.Width, 130)
End If
End Sub
|
sham1980
一般會員 發表:17 回覆:14 積分:6 註冊:2005-05-10 發送簡訊給我 |
|
kennan8176
一般會員 發表:8 回覆:9 積分:3 註冊:2005-04-11 發送簡訊給我 |
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
'向下
If picRunner.Location.X > -(picRunner.Width) Then
picRunner.Location = New Point(picRunner.Location.X, picRunner.Location.Y + 20)
Else
picRunner.Location = New Point(Me.Width, 130) '是判斷碰到牆壁時回到起始
End If
End Sub
是為了案著Botton時候可以循環移動
引言: 不是只要這一行就可以了嗎?不知道你其他的判斷是要做什麼的?可以跟我說嗎? picRunner.Location = New Point(picRunner.Location.X, picRunner.Location.Y 20) |
sham1980
一般會員 發表:17 回覆:14 積分:6 註冊:2005-05-10 發送簡訊給我 |
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'向左移動,碰底到從右邊從新
If picRunner.Location.X > 0 Then
picRunner.Location = New Point(picRunner.Location.X - 20, picRunner.Location.Y)
Else
picRunner.Location = New Point(Me.Width, picRunner.Location.Y)
End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
'向右,碰底到從左邊從新
If picRunner.Location.X < Me.Width Then
picRunner.Location = New Point(picRunner.Location.X 20, picRunner.Location.Y)
Else
picRunner.Location = New Point(0, picRunner.Location.Y)
End If
End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
'向上,碰底到從下面從新
If picRunner.Location.Y > 0 Then
picRunner.Location = New Point(picRunner.Location.X, picRunner.Location.Y - 20)
Else
picRunner.Location = New Point(picRunner.Location.X, Me.Height)
End If
End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
'向下,碰底到從上面從新
If picRunner.Location.Y < Me.Height Then
picRunner.Location = New Point(picRunner.Location.X, picRunner.Location.Y 20)
Else
picRunner.Location = New Point(picRunner.Location.X, 0)
End If
End Sub
|
kennan8176
一般會員 發表:8 回覆:9 積分:3 註冊:2005-04-11 發送簡訊給我 |
太感謝了...我剛才找出為啥..就是不能向下移動
因為初始值我設定在底端難怪看不到向下移動的畫面= ="
感謝大大唷~非常完整....
引言: Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click '向左移動,碰底到從右邊從新 If picRunner.Location.X > 0 Then picRunner.Location = New Point(picRunner.Location.X - 20, picRunner.Location.Y) Else picRunner.Location = New Point(Me.Width, picRunner.Location.Y) End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click '向右,碰底到從左邊從新 If picRunner.Location.X < Me.Width Then picRunner.Location = New Point(picRunner.Location.X 20, picRunner.Location.Y) Else picRunner.Location = New Point(0, picRunner.Location.Y) End If End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click '向上,碰底到從下面從新 If picRunner.Location.Y > 0 Then picRunner.Location = New Point(picRunner.Location.X, picRunner.Location.Y - 20) Else picRunner.Location = New Point(picRunner.Location.X, Me.Height) End If End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click '向下,碰底到從上面從新 If picRunner.Location.Y < Me.Height Then picRunner.Location = New Point(picRunner.Location.X, picRunner.Location.Y 20) Else picRunner.Location = New Point(picRunner.Location.X, 0) End If End Sub |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |