<script type="text/javascript">
</script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
分给上个问题了,我没分给了,还请多指教下这个问题=_=
Dim pic As New PictureBox
pic.ImageLocation = "buke/ " & ss & ".png "
pic.Name = ss
pic.Location = New System.Drawing.Point(x - i * 30, y)
pic.Width = 94
pic.Height = 125
AddHandler pic.Click, AddressOf pic_Click '' '' ''这里用
------------------------
Private Sub pic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim a, b, c As Integer
a = (sender).Location.X
b = (sender).Location.Y
'' '' '' ''MsgBox(a) = 790
c = b - 10
If Ya - c > 10 Then c = Ya
sender.Location = New System.Drawing.Point(a, c)
Dim str As String = sender.Name
MsgBox(str)
End Sub
-----------
问:
当我sender.点的时候后面没有出来相对应他的属性
是不是应该用什么转换下?
我用((PictureBox)sender)不行,
那我应该怎么写才能让他出来呢??
没分了给了,还请前辈们多指点!!!
__________________________________________________________________________
ctype(sender,picturebox)
__________________________________________________________________________
用pic就行啦,为什么用sender呢?
__________________________________________________________________________
因为sender代表的对象是不确定的,所以他没有属性。
__________________________________________________________________________
我是说您说的“相对应的属性”。
__________________________________________________________________________
因为pic是动态生成的在另个函数里面
直接在别的函数里用pic提示找不到这个控件
dim s as integer = ctype(sender,picturebox).Location.X
好用了!谢谢
也谢谢magicbacon(Cannot help coding) ,你是不是也是都是在晚间活动呀?/
我也是,这样晚上就有高手指点了,嘿嘿
__________________________________________________________________________
嘿嘿,昼伏夜出。
__________________________________________________________________________
但还是菜鸟啊,唉。
__________________________________________________________________________
分给上个问题了,我没分给了,还请多指教下这个问题=_=
Dim pic As New PictureBox
pic.ImageLocation = "buke/ " & ss & ".png "
pic.Name = ss
pic.Location = New System.Drawing.Point(x - i * 30, y)
pic.Width = 94
pic.Height = 125
AddHandler pic.Click, AddressOf pic_Click '' '' ''这里用
------------------------
Private Sub pic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim a, b, c As Integer
a = (sender).Location.X
b = (sender).Location.Y
'' '' '' ''MsgBox(a) = 790
c = b - 10
If Ya - c > 10 Then c = Ya
sender.Location = New System.Drawing.Point(a, c)
Dim str As String = sender.Name
MsgBox(str)
End Sub
-----------
问:
当我sender.点的时候后面没有出来相对应他的属性
是不是应该用什么转换下?
我用((PictureBox)sender)不行,
那我应该怎么写才能让他出来呢??
没分了给了,还请前辈们多指点!!!
__________________________________________________________________________
ctype(sender,picturebox)
__________________________________________________________________________
用pic就行啦,为什么用sender呢?
__________________________________________________________________________
因为sender代表的对象是不确定的,所以他没有属性。
__________________________________________________________________________
我是说您说的“相对应的属性”。
__________________________________________________________________________
因为pic是动态生成的在另个函数里面
直接在别的函数里用pic提示找不到这个控件
dim s as integer = ctype(sender,picturebox).Location.X
好用了!谢谢
也谢谢magicbacon(Cannot help coding) ,你是不是也是都是在晚间活动呀?/
我也是,这样晚上就有高手指点了,嘿嘿
__________________________________________________________________________
嘿嘿,昼伏夜出。
__________________________________________________________________________
但还是菜鸟啊,唉。
__________________________________________________________________________