Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: (untagged)
hey
am building a button class in the programming language visual basic
i just need some help with the coding
so far i have something that looks like this

VB
Imports System.Drawing
Public Class YOUR CLASS NAME
    Inherits Windows.Forms.Button
    Public Sub New()
        Me.Size = New Point(32, 32)
        Me.FlatStyle = Windows.Forms.FlatStyle.Flat
        Me.FlatAppearance.BorderSize = 0
        Me.FlatAppearance.BorderColor = System.Drawing.Color.Gray
        Me.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent
        Me.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent
        Me.BackColor = System.Drawing.Color.Transparent
        Me.BackgroundImage = My.Resources.YOUR NORMAL IMAGE
        Me.BackgroundImageLayout = Windows.Forms.ImageLayout.Stretch
        Me.Font = New System.Drawing.Font("Tahoma", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    End Sub
Private Sub Backbutton_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        Me.BackgroundImage  My.Resources = your mouse click the image
    End Sub
 Private Sub Backbutton_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseEnter
        Me.BackgroundImage = My.Resources.YOUR MOUSE ON IMAGE
    End Sub
Private Sub Backbutton_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave
        Me.BackgroundImage = My.Resources.YOUR NORMAL IMAGE
    End Sub
Private Sub Backbutton_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
        Me.BackgroundImage = My.Resources.YOUR MOUSE ON IMAGE
    End Sub
End Class


and i want it the button to be like Me.BackgroundImage My.Resources = your mouse click the image or just simply when u click it just want it to stay this way

thanks in advance
Posted
Updated 16-Oct-12 8:25am
v3
Comments
Sergey Alexandrovich Kryukov 15-Oct-12 21:26pm    
Do you mean no visual feedback of mouse state? Why?! And, what's the problem?
--SA
sean871 15-Oct-12 21:35pm    
yes no visual feedback of the mouse state
sean871 15-Oct-12 22:08pm    
so its like when i click the button it gonna stay like
Me.BackgroundImage My.Resources = your mouse click the image
sean871 16-Oct-12 10:09am    
yes that's what i need plz help
n.podbielski 16-Oct-12 14:33pm    
Why? User suppose to know that his doings have effect.

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900