Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to 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
 
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 15-Oct-12 16:17pm
sean871507
Edited 16-Oct-12 9:25am
Maciej Los158.9K
v3
Comments
Sergey Alexandrovich Kryukov at 15-Oct-12 21:26pm
   
Do you mean no visual feedback of mouse state? Why?! And, what's the problem?
--SA
dannyantoine at 15-Oct-12 21:35pm
   
yes no visual feedback of the mouse state
dannyantoine at 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
dannyantoine at 16-Oct-12 10:09am
   
yes that's what i need plz help
n.podbielski at 16-Oct-12 14:33pm
   
Why? User suppose to know that his doings have effect.
Marcus Kramer at 16-Oct-12 14:36pm
   
Bad form. You shouldn't mess with default behavior like that, it will confuse the user.

1 solution

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

  Print Answers RSS
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,260


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 16 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100