sub text_blue(byval textname as textbox)
textname.backcolor=vbblue
end sub你給每一個text 添加一個 gotfocus 事件 在事件中調用 過程
text_blue 控件名 即可
textname.backcolor=vbblue
end sub你給每一個text 添加一個 gotfocus 事件 在事件中調用 過程
text_blue 控件名 即可
解决方案 »
- 怎么实现将xml里读出的数据在Datagrid里显示
- 运行一个存储过程后将所得的记录集设置到datagrid时出错怎样解决?
- 工程组中有两个工程 ,如果在两个独立的工程中传递数据 或者相互打开
- FSO对象中获取及改变文件属性的方法是什么?
- 水晶报表导出(Export)功能的问题
- 寻求VB教程,要能免费下栽的,提供下栽网址者分数向送!!!
- 用什么语言开发仿真软件好?
- 关于MSHFlexGrid控件的问题?
- VB在ACCESS中应用的一个小问题!
- frame1作为容器,里面加载了一个command,请问如何利用command返回“frame1”?为什么用command1.parent.caption 返回的是“form1”?
- 怎样使鼠标移上时出现提示?50分相送!
- 鼠标位置问题?
If TypeOf ctl Is TextBox Then
MsgBox ctl.Name
End If
Next
Public Const G_FIELD_FORECOLOR_ENABLE = vbWindowText
Public Const G_FIELD_BACKCOLOR_FOCUS = vbYellow
Public Const G_FIELD_FORECOLOR_FOCUS = vbBlue
Public Const G_FIELD_BACKCOLOR_DISABLE = &HFFC0C0
Function intColorSet(intStatus As Integer, objControls As Control) As Integer intColorSet = -1
If intStatus <> G_FIELD_DISABLE And objControls.Enabled = False Then
intColorSet = 0
Exit Function
End If
Select Case intStatus
Case G_FIELD_ENABLE
objControls.BackColor = G_FIELD_BACKCOLOR_ENABLE
objControls.ForeColor = G_FIELD_FORECOLOR_ENABLE
Case G_FIELD_FOCUS
objControls.BackColor = G_FIELD_BACKCOLOR_FOCUS
objControls.ForeColor = G_FIELD_FORECOLOR_FOCUS
Case G_FIELD_DISABLE
objControls.ForeColor = G_FIELD_FORECOLOR_ENABLE
objControls.BackColor = G_FIELD_BACKCOLOR_DISABLE
End Select
intColorSet = 0End FunctionPrivate Sub text1_GotFocus()
Call intColorSet(G_FIELD_FOCUS, Me.text1)
End Sub
Text1(Index).BackColor = vbBlue
End SubPrivate Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
End If
End SubPrivate Sub Text1_LostFocus(Index As Integer)
Text1(Index).BackColor = vbWhite
End Sub