DatasheetFontItalic 屬性

此頁沒有內(nèi)容條目
內(nèi)容

expandtri全部顯示

使用 DatasheetFontItalic 屬性可以指定在“數(shù)據(jù)表”視圖中字段名稱和數(shù)據(jù)是否顯示為傾斜。Boolean 型,可讀/寫。

expression.DatasheetFontItalic

expression     必需。返回“應用于”列表中的一個對象的表達式。

說明

DatasheetFontItalic 屬性應用于“數(shù)據(jù)表”視圖中的所有字段,以及“數(shù)據(jù)表”視圖中的窗體的控件。

該屬性僅在 Microsoft Access 數(shù)據(jù)庫 (.mdb) 中使用 Visual Basic 時才可用。

在 Visual Basic 中,DatasheetFontItalic 屬性使用以下設(shè)置:

設(shè)置

說明

True

文字是傾斜的。

False

(默認)文字不是傾斜的。

 

注釋  您可以通過在“格式(數(shù)據(jù)表)”工具欄上單擊“傾斜”來設(shè)置該屬性。

也可以在“數(shù)據(jù)表”視圖中單擊“格式”菜單上的“字體”,在“字體”對話框中設(shè)置該屬性。

下表列出了 DAO Properties 集合中的部分屬性。這些屬性在用戶使用“格式(數(shù)據(jù)表)”工具欄對其進行設(shè)置,或使用 CreateProperty 方法將這些屬性添加到 Access 數(shù)據(jù)庫 (.mdb) 并將其追加到 DAO Properties 集合中之前不存在。

DatasheetFontItalic *

DatasheetForeColor*

DatasheetFontHeight*

DatasheetBackColor

DatasheetFontName*

DatasheetGridlinesColor

DatasheetFontUnderline*

DatasheetGridlinesBehavior

DatasheetFontWeight*

DatasheetCellsEffect

 

注釋  當添加或設(shè)置任何帶有星號的屬性時,Microsoft Access 自動將所有帶星號的屬性添加到數(shù)據(jù)庫的 Properties 集合中。

示例

以下示例在“數(shù)據(jù)表”視圖中將“產(chǎn)品”窗體的數(shù)據(jù)和字段名稱顯示為傾斜和帶下劃線。

Forms![Products].DatasheetFontItalic = True

Forms![Products].DatasheetFontUnderline = True

下一個示例在“數(shù)據(jù)表”視圖中將“產(chǎn)品”表的數(shù)據(jù)和字段名稱顯示為傾斜和帶下劃線。

為設(shè)置 DatasheetFontItalicDatasheetFontUnderline 屬性,該示例使用數(shù)據(jù)庫標準模塊中的 SetTableProperty 過程。

Dim dbs As Object, objProducts As Object

Const DB_Boolean As Long = 1

Set dbs = CurrentDb

Set objProducts = dbs![Products]

SetTableProperty objProducts, "DatasheetFontItalic", DB_Boolean, True

SetTableProperty objProducts, "DatasheetFontUnderline", DB_Boolean, True

Sub SetTableProperty(objTableObj As Object, strPropertyName As String, _

        intPropertyType As Integer, varPropertyValue As Variant)

    ' Set Microsoft Access-defined table property without causing

    ' nonrecoverable run-time error.

    Const conErrPropertyNotFound = 3270

    Dim prpProperty As Variant

    On Error Resume Next                ' Don't trap errors.

    objTableObj.Properties(strPropertyName) = varPropertyValue

    If Err <> 0 Then                    ' Error occurred when value set.

        If Err <> conErrPropertyNotFound Then

            On Error GoTo 0

            MsgBox "Couldn't set property '" & strPropertyName _

                & "' on table '" & objTableObj.Name & "'", 48, "SetTableProperty"

        Else

            On Error GoTo 0

            Set prpProperty = objTableObj.CreateProperty(strPropertyName, _

                intPropertyType, varPropertyValue)

            objTableObj.Properties.Append prpProperty

        End If

    End If

    objTableObj.Properties.Refresh

End Sub