注册 登录
编程论坛 VB.NET论坛

关于PictureBox图片切换的问题~~急

goodwellxp 发布于 2008-01-17 19:57, 2979 次点击
我原来在PicuureBOx控件设置了一张图片,想使用PictureBox控件mousemove和mouseEnter在鼠标进入图片的时候切换另一张图片.代码使用
Private Sub PictureBox2_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox2.MouseMove
        Image.FromFile("C:\sss.jpg")
    End Sub

但是发现这样设置,运行时还是不能换,一点反应都没有MouseEnter也试过了,也不行
请教高手这是怎么一回事.
4 回复
#2
fairy42008-01-18 08:35
mousemove和mouseEnter是可以在鼠標進入時切換圖片的!有問題的是你的代碼吧?????
你試下這個:
PictureBox1.Image = Nothing
 PictureBox1.Image = Image.FromFile("D:\sss.jpg")
 PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
#3
goodwellxp2008-01-23 21:51
问题已解决,谢谢
#4
chenjun8662008-02-09 00:05
    '鼠标移动到图片上时的图片设置
    Private Sub PictureBox2_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox2.MouseEnter
        Me.PictureBox2.Image = My.Resources.play_stop_2
    End Sub
    '鼠标离开图片上时的图片设置
    Private Sub PictureBox2_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox2.MouseLeave
        Me.PictureBox2.Image = My.Resources.play_stop_1
    End Sub
#5
daoliang2008-03-12 00:55
高手就是高手,真让我佩服啊,我什么时候才能有你们这样的水平啊
1