I'm using a border-less form.

Well when i press the Tab button the form looks like it refresh for a sec then when i click the button it looks like this ( After - Before )

http://img823.imageshack.us/img823/8359/65608283.png

how can i prevent it to look with that border ?

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.