English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

我的程式如下:(還有如何讓我的按鍵按到圖至邊界就反灰不可以按??)
Private Sub Command1_Click(Index As Integer)
Image1.Top = Image1.Top + 100
If Image1.Top + Image1.Height > Form1.ScaleHeight Then
Image1.Top = Form1.ScaleHeight - Image1.Height
End If

End Sub
Private Sub Command2_Click()
Image1.Left = Image1.Left + 100
If Image1.Left + Image1.Width > Form1.ScaleWidth Then
Image1.Left = Form1.ScaleWidth - Image1.Width
End If

End Sub
Private Sub Command3_Click()
Image1.Left = 3720
Image1.Top = 1320
End Sub
Private Sub Command4_Click()
Image1.Top = Image1.Top - 100
If Image1.Top < 0 Then
Image1.Top = 0
End If
End Sub
Private Sub Command5_Click()
Image1.Left = Image1.Left - 100
If Image1.Left < 0 Then
Image1.Left = 0
End If
End Sub

2006-12-18 17:56:25 · 2 個解答 · 發問者 Anonymous in 電腦與網際網路 程式設計

座標為當圖片移動它的位在哪個座標上,必須以LABEL或者TEXT顯示出來~

2006-12-18 20:04:58 · update #1

座標必須以即時顯現~每移動一步座標就會隨位置而改變!!

2006-12-18 20:08:39 · update #2

2 個解答


'不瞭解為何Command1要做成物件陣列,還有你並未說明座標指的是Image的那裡,所以在此把它當做是X=Left Y=Top
Private Sub Command1_Click(Index As Integer)
Image1.Top = Image1.Top + 100
Command4.Enabled = True
If Image1.Top + Image1.Height > Form1.ScaleHeight Then Image1.Top = Form1.ScaleHeight - Image1.Height: Command1(Index).Enabled = False
Text1 = "X=" & Image1.Left & " Y=" & Image1.Top
End Sub
Private Sub Command2_Click()
Image1.Left = Image1.Left + 100
Command5.Enabled = True
If Image1.Left + Image1.Width > Form1.ScaleWidth Then Image1.Left = Form1.ScaleWidth - Image1.Width: Command2.Enabled = False
Text1 = "X=" & Image1.Left & " Y=" & Image1.Top
End Sub
Private Sub Command3_Click()
Dim A
Image1.Left = 3720: Image1.Top = 1320
Text1 = "X=3720 Y=1320"
For Each A In Controls
If TypeOf A Is CommandButton Then A.Enabled = True
Next
End Sub
Private Sub Command4_Click()
Dim A

Image1.Top = Image1.Top - 100
For Each A In Controls
If TypeOf A Is CommandButton And A.Name = "Command1" Then A.Enabled = True
Next
If Image1.Top < 0 Then Image1.Top = 0: Command4.Enabled = False
Text1 = "X=" & Image1.Left & " Y=" & Image1.Top
End Sub
Private Sub Command5_Click()
Image1.Left = Image1.Left - 100
Command2.Enabled = True
If Image1.Left < 0 Then Image1.Left = 0: Command5.Enabled = False
Text1 = "X=" & Image1.Left & " Y=" & Image1.Top
End Sub

2006-12-18 19:20:10 · answer #1 · answered by W.J.S. 7 · 0 0

1.讓妳的TEXTBOX.TEXT= Image.Left
ex. text1.text ="x=" & Image1.Left & "y=" & Image1.Top = 1320
2. Command box的反灰就是Enable
ex: Command1.Enabled = False 就是反灰
Command1.Enabled =True 就是不反灰

2006-12-18 18:43:35 · answer #2 · answered by Sing 3 · 0 0

fedest.com, questions and answers