PC Review


Reply
Thread Tools Rate Thread

Change the look of a button.

 
 
=?Utf-8?B?UnVkeQ==?=
Guest
Posts: n/a
 
      12th Nov 2004
Hello all,

Can you take a button, color it green, have the user click on it, change the
color to red, to show it has been selected. IF so, how?

As always, thank in advance!

Rudy
 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      12th Nov 2004
"Rudy" <(E-Mail Removed)> schrieb:
> Can you take a button, color it green, have the user click on it, change
> the
> color to red, to show it has been selected. IF so, how?


\\\
DirectCast(sender, Control).BackColor = Colors.Red
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      12th Nov 2004
Rudy,

Maybe it can shorter however this works
\\\
If Button1.BackColor.ToArgb = Color.Red.ToArgb Then
Button1.BackColor = Color.Green
Else
Button1.BackColor = Color.Red
End If
///
I hope this helps?

Cor


 
Reply With Quote
 
Chris
Guest
Posts: n/a
 
      12th Nov 2004
Easy, Trap the button click event and change the backcolor

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click

btnSave.backcolor = system.drawing.color.red

End Sub

Hope is helps

Chris

"Rudy" <(E-Mail Removed)> wrote in message
news:9A432D00-4D47-483E-B88B-(E-Mail Removed)...
> Hello all,
>
> Can you take a button, color it green, have the user click on it, change
> the
> color to red, to show it has been selected. IF so, how?
>
> As always, thank in advance!
>
> Rudy



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      12th Nov 2004
"Cor Ligthert" <(E-Mail Removed)> schrieb:
> Maybe it can shorter however this works
> \\\
> If Button1.BackColor.ToArgb = Color.Red.ToArgb Then


\\\
If Button1.BackColor.Equals(Color.Red) Then
...
End If
///

Just my 2 Euro cents...

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      12th Nov 2004
Herfried,

I was curious in changing the rgb values with an Or or something, this is
not shorter however nothing wrong with.

Cor

"Herfried K. Wagner [MVP]"

> "Cor Ligthert" <(E-Mail Removed)> schrieb:
>> Maybe it can shorter however this works
>> \\\
>> If Button1.BackColor.ToArgb = Color.Red.ToArgb Then

>
> \\\
> If Button1.BackColor.Equals(Color.Red) Then
> ...
> End If
> ///
>
> Just my 2 Euro cents...
>
> --
> Herfried K. Wagner [MVP]
> <URL:http://dotnet.mvps.org/>



 
Reply With Quote
 
=?Utf-8?B?UnVkeQ==?=
Guest
Posts: n/a
 
      12th Nov 2004
Thanks for all the tips, I'll try it out tonight!

"Chris" wrote:

> Easy, Trap the button click event and change the backcolor
>
> Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles btnSave.Click
>
> btnSave.backcolor = system.drawing.color.red
>
> End Sub
>
> Hope is helps
>
> Chris
>
> "Rudy" <(E-Mail Removed)> wrote in message
> news:9A432D00-4D47-483E-B88B-(E-Mail Removed)...
> > Hello all,
> >
> > Can you take a button, color it green, have the user click on it, change
> > the
> > color to red, to show it has been selected. IF so, how?
> >
> > As always, thank in advance!
> >
> > Rudy

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change the Ok button to a Close ('X') button for a Modal Dialog NAVMED Microsoft Dot NET Compact Framework 4 27th Jan 2009 09:31 PM
Inspector doesn't change Save-Button to Send-Button when adding recipients via VB HarryWild Microsoft Outlook Program Addins 0 16th Jan 2008 10:20 AM
change toolstrip button colour when button pressed =?Utf-8?B?TWVs?= Microsoft C# .NET 3 29th Nov 2005 12:31 AM
Anyone know how to change color for a 3D button like this button control does? TonyVal - MSDN News Microsoft Dot NET Framework Forms 5 12th Jul 2005 06:40 PM
Anyone know how to change color for a 3D button like this button control does? TonyVal - MSDN News Microsoft VB .NET 2 11th Jul 2005 11:21 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:29 AM.