当前位置:编程学习 > C#/ASP.NET >>

当控件获得焦点时,如何将背景色发生变化 ?

比如当TextBox或ComboBox控件获得焦点,则立刻将它的背景色改为其它颜色
--------------------编程问答-------------------- <input type=text onfocus="this.style.backgroundColor='red'" onblur="this.style.backgroundColor=''"> --------------------编程问答-------------------- 错了.以为你是web.MS是winform --------------------编程问答-------------------- 各位是使用VB.NET开发的,请大家帮帮我啊 --------------------编程问答-------------------- Public Class Form1

    Private Sub Button1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.GotFocus
        Me.Button1.BackColor = Color.Green
    End Sub

    Private Sub Button1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.LostFocus
        Me.Button1.BackColor = Color.FromArgb(-2830136)
    End Sub

End Class --------------------编程问答-------------------- 当获得焦点时变成绿色,失去时变回原来颜色。 --------------------编程问答-------------------- 顶,楼上说的对
补充:.NET技术 ,  VB.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,