鼠标悬停时将按钮BG颜色设置为透明

时间:2014-02-15 04:19:03

标签: vb.net

当我悬停/点击按钮时,如何更改此按钮的背景颜色?这是图像: http://i.minus.com/ib0pWwQBJ6nlW9.JPG

2 个答案:

答案 0 :(得分:0)

尝试添加此内容:

Private Sub button1_MouseHover(sender As Object, e As EventArgs)
    Me.button1.BackColor = Color.Transparent
End Sub

Private Sub button1_MouseLeave(sender As Object, e As EventArgs)
    Me.button1.BackColor = Color.Blue
End Sub

<强>(OR)

nextBtn.FlatAppearance.MouseOverBackColor=Color.Transparent

查看here

答案 1 :(得分:0)

在Web表单加载事件上更容易

oggetto是您案例中的按钮

dim oggetto as object 
oggetto.Attributes.Add("onmouseover",this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='transparent'")

然后将其放回鼠标中

oggetto.Attributes.Add("onmouseout",this.style.backgroundColor=this.originalstyle;")