This is a migrated thread and some comments may be shown as answers.

Color Mouse Over

3 Answers 161 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Andrés David Santacoloma Isaza
Top achievements
Rank 1
Andrés David Santacoloma Isaza asked on 17 Jan 2011, 05:11 PM
Hi:
I need to put a code with which the color of my button is the same that appears when you put your mouse over it.
Thanks.

3 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 17 Jan 2011, 05:23 PM
Hello,

You can do a few things here. You could either create your own theme using visual style builder or if you just want to keep mouse over style on all, then you can use the following code

In form load
Me.RadButton1.ButtonElement.IsMouseOver = True
AddHandler Me.RadButton1.ButtonElement.RadPropertyChanging, AddressOf Button_RadPropertyChanging

then
Private Sub Button_RadPropertyChanging(ByVal sender As Object, ByVal e As RadPropertyChangingEventArgs)
    If e.Property.Name = "IsMouseOver" Then
        e.Cancel = True
    End If
End Sub

hope that helps
Richard
0
Andrés David Santacoloma Isaza
Top achievements
Rank 1
answered on 17 Jan 2011, 08:30 PM
Hi:
Thanks, that code is rigth, but I need put the color when click, and quit this color when I click on other button.
How I do it?

Thanks.
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 18 Jan 2011, 12:39 AM
Hello again,

Here you are. Just two buttons on a form.
RadButtonColorOn is the button that will have the mouse over colour applied, and will stay on until you click RadButtoncolorOff

Private Sub RadButtonColorOn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadButtonColorOn.Click
    Me.RadButtonColorOn.ButtonElement.IsMouseOver = True
    AddHandler Me.RadButtonColorOn.ButtonElement.RadPropertyChanging, AddressOf Button_RadPropertyChanging
End Sub
Private Sub RadButtonColorOff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadButtonColorOff.Click
    Me.RadButtonColorOn.ButtonElement.IsMouseOver = False
    RemoveHandler Me.RadButtonColorOn.ButtonElement.RadPropertyChanging, AddressOf Button_RadPropertyChanging
End Sub
Private Sub Button_RadPropertyChanging(ByVal sender As Object, ByVal e As RadPropertyChangingEventArgs)
    If e.Property.Name = "IsMouseOver" Then
        e.Cancel = True
    End If
End Sub

Hope that helps
Richard
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Andrés David Santacoloma Isaza
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Andrés David Santacoloma Isaza
Top achievements
Rank 1
Share this question
or