Home All Groups Group Topic Archive Search About

Rollover button sampel

Author
6 Jun 2006 3:05 PM
Manekurt
Hello, does anyone has a simple sample of a rollover button control? I need
to asign 2 images, one for mouse enter, and otherone for mose leave. I tried
to make one, but I cant asign same images form the resources of the project
Thank you

Author
6 Jun 2006 3:35 PM
tlkerns
I think this is what you are looking for:

Public Class MyButton
    Inherits System.Windows.Forms.Button

    Private m_TempImage As System.Drawing.Image
    Private m_MouseOverImage As System.Drawing.Image
    Public Property MouseOverImage() As System.Drawing.Image
        Get
            Return m_MouseOverImage
        End Get
        Set(ByVal value As System.Drawing.Image)
            m_MouseOverImage = value
        End Set
    End Property

    Private Sub MyButton_MouseEnter(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.MouseEnter
        m_TempImage = Me.Image
        Me.Image = m_MouseOverImage
    End Sub

    Private Sub MyButton_MouseLeave(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.MouseLeave
        Me.Image = m_TempImage
    End Sub
End Class

Tony

Show quoteHide quote
"Manekurt" wrote:

> Hello, does anyone has a simple sample of a rollover button control? I need
> to asign 2 images, one for mouse enter, and otherone for mose leave. I tried
> to make one, but I cant asign same images form the resources of the project
> Thank you
>
>
>
Author
6 Jun 2006 5:26 PM
Manekurt
Thank you, that worked perfect!!

Thanx! manek
Show quoteHide quote
"tlkerns" <tlke***@discussions.microsoft.com> escribió en el mensaje
news:7470828D-B43C-4D20-BD17-D37F724726DF@microsoft.com...
>I think this is what you are looking for:
>
> Public Class MyButton
>    Inherits System.Windows.Forms.Button
>
>    Private m_TempImage As System.Drawing.Image
>    Private m_MouseOverImage As System.Drawing.Image
>    Public Property MouseOverImage() As System.Drawing.Image
>        Get
>            Return m_MouseOverImage
>        End Get
>        Set(ByVal value As System.Drawing.Image)
>            m_MouseOverImage = value
>        End Set
>    End Property
>
>    Private Sub MyButton_MouseEnter(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Me.MouseEnter
>        m_TempImage = Me.Image
>        Me.Image = m_MouseOverImage
>    End Sub
>
>    Private Sub MyButton_MouseLeave(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Me.MouseLeave
>        Me.Image = m_TempImage
>    End Sub
> End Class
>
> Tony
>
> "Manekurt" wrote:
>
>> Hello, does anyone has a simple sample of a rollover button control? I
>> need
>> to asign 2 images, one for mouse enter, and otherone for mose leave. I
>> tried
>> to make one, but I cant asign same images form the resources of the
>> project
>> Thank you
>>
>>
>>