2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by codeorder
0

You should be able to use the _MouseDown and _MouseUp events to trigger to outlook of the image.

Public Class Form1

    Private imgX As Image = Image.FromFile("C:\!vb.net\images\x.png")
    Private imgXclicked As Image = Image.FromFile("C:\!vb.net\images\x_clicked.png")

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Button1.BackgroundImageLayout = ImageLayout.Stretch
        Button1.Image = imgX
    End Sub

    Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown
        Button1.Image = imgXclicked
    End Sub

    Private Sub Button1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseUp
        Button1.Image = imgX
    End Sub

End Class
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.