Access) (CommandButton.BorderColor 屬性
使用 BorderColor 屬性可指定控制項框線的色彩。 讀取/寫入的 Long。
運算式。BorderColor
表達 代表 CommandButton 物件的變數。
BorderColor屬性設定是數值運算式,對應至您要用於控制項框線的色彩。
您可以使用控制項的預設控制項樣式或 Visual Basic 中的 DefaultControl 屬性來設定這個屬性的預設值。
控制項的框線色彩可見時才是其 SpecialEffect 屬性設定為平面或陰影。 如果以外 SpecialEffect 屬性設為平面或陰影,設定 BorderColor 屬性, SpecialEffect 屬性設定變更為普通。
下列範例會根據 txtPastDue 文字方塊的值,使用 RGB 函數以設定 BorderColor、BackColor 及 ForeColor 屬性。 您也可以使用 QBColor 函數來設定這些屬性。
將下列程式碼放入 Form_Current ( ) 事件會在使用者開啟表單或移至新記錄時,立即設定控制項顯示特性。
Sub Form_Current()
Dim curAmntDue As Currency, lngBlack As Long
Dim lngRed As Long, lngYellow As Long, lngWhite As Long
If Not IsNull(Me!txtPastDue.Value) Then
curAmntDue = Me!txtPastDue.Value
Else
Exit Sub
End If
lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)
If curAmntDue > 100 Then
Me!txtPastDue.BorderColor = lngRed
Me!txtPastDue.ForeColor = lngRed
Me!txtPastDue.BackColor = lngYellow
Else
Me!txtPastDue.BorderColor = lngBlack
Me!txtPastDue.ForeColor = lngBlack
Me!txtPastDue.BackColor = lngWhite
End If
End Sub
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。