button background colour on mouse enter event

Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Apr 2008
Posts: 114
Reputation: ninjaimp is an unknown quantity at this point 
Solved Threads: 6
ninjaimp ninjaimp is offline Offline
Junior Poster

button background colour on mouse enter event

 
0
  #1
Nov 20th, 2008
I trying to create some, what i thought, simple rollover buttons. everything works fine except that the background colour on the mouse enter is always different to what i set.

I have tried all the different flat settings on if set to 'flat' the background colour allways appears different despite to to directly set the colour - if i set the flat to 'popup' then the background colour changes fine but the borders go all funny on the mouse enter.

I just wondered if anyone had any ideas - my button code is below
cheers

  1. Private Sub Button5_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.MouseEnter
  2. Button5.Image = My.Resources.Left
  3. Button5.FlatStyle = FlatStyle.Popup
  4. Button5.BackColor = Color.MistyRose
  5.  
  6.  
  7. End Sub
  8.  
  9. Private Sub Button5_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.MouseLeave
  10. Button5.Image = My.Resources.Left_down
  11. Button5.FlatStyle = FlatStyle.Popup
  12. Button5.BackColor = Color.MistyRose
  13.  
  14. End Sub
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 710
Reputation: Teme64 will become famous soon enough Teme64 will become famous soon enough 
Solved Threads: 114
Teme64's Avatar
Teme64 Teme64 is offline Offline
Master Poster

Re: button background colour on mouse enter event

 
0
  #2
Nov 21st, 2008
I tried your code and it changes bg-color just fine. I changed FlatStyle.Flat and bg-color still changes fine.

If you set FlatStyle.Flat, have you checked FlatAppearance properties (borders & colors)? It seems FlatAppearance properties are design time props and are ReadOnly in the run-time. Anyway, changing FlatAppearance may solve your problem.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 114
Reputation: ninjaimp is an unknown quantity at this point 
Solved Threads: 6
ninjaimp ninjaimp is offline Offline
Junior Poster

Re: button background colour on mouse enter event

 
0
  #3
Nov 21st, 2008
ideal - ill give it a go and let you know how i get on!

thanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC