FillColor 屬性

此頁沒有內容條目
內容

expandtri全部顯示

使用 FillColor 屬性可以指定用 LineCircle 方法在報表中繪制的方框和圓的填充顏色。在使用彩色打印機打印或在彩色監(jiān)視器中預覽報表時,也可以在 Visual Basic 中使用此屬性來建立自定義報表中的特殊視覺效果。Long 型,可讀/寫。

expression.FillColor

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

說明

FillColor 屬性包含一個數值表達式,該表達式用于指定所有方框和圓的填充顏色。

可以使用節(jié)的 OnPrint 事件屬性指定的或 Visual Basic 事件過程來設置該屬性。

可以使用 RGBQBColor 函數來設置該屬性。FillColor 屬性設置具有 Long 數據類型。

示例

以下示例使用 Circle 方法來繪制圓,并且在圓中創(chuàng)建扇形,然后使用 FillColorFillStyle 屬性將扇形顏色設為紅色,同時也在左上方到圓心之間畫了一條直線。

若要在 Microsoft Access 中測試此示例,先新建一個報表。將主體節(jié)的“打印”屬性設置為 [事件過程]。在報表模塊中輸入下列代碼,然后切換到“打印預覽”。

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

    Const conPI = 3.14159265359

    Dim sngHCtr As Single

    Dim sngVCtr As Single

    Dim sngRadius As Single

    Dim sngStart As Single

    Dim sngEnd As Single

    sngHCtr = Me.ScaleWidth / 2               ' Horizontal center.

    sngVCtr = Me.ScaleHeight / 2              ' Vertical center.

    sngRadius = Me.ScaleHeight / 3            ' Circle radius.

    Me.Circle (sngHCtr, sngVCtr), sngRadius   ' Draw circle.

    sngStart = -0.00000001                    ' Start of pie slice.

    sngEnd = -2 * conPI / 3                   ' End of pie slice.

    Me.FillColor = RGB(255, 0, 0)             ' Color pie slice red.

    Me.FillStyle = 0                          ' Fill pie slice.

    ' Draw Pie slice within circle

    Me.Circle (sngHCtr, sngVCtr), sngRadius, , sngStart, sngEnd

    ' Draw line to center of circle.

    Dim intColor As Integer

    Dim sngTop As Single, sngLeft As Single

    Dim sngWidth As Single, sngHeight As Single

    Me.ScaleMode = 3                          ' Set scale to pixels.

    sngTop = Me.ScaleTop                      ' Top inside edge.

    sngLeft = Me.ScaleLeft                    ' Left inside edge.

    sngWidth = Me.ScaleWidth / 2              ' Width inside edge.

    sngHeight = Me.ScaleHeight / 2            ' Height inside edge.

    intColor = RGB(255, 0, 0)                 ' Make color red.

    ' Draw line.

    Me.Line (sngTop, sngLeft)-(sngWidth, sngHeight), intColor

End Sub