全部显示

FillColor 属性

       

使用 FillColor 属性可以指定用 LineCircle 方法在报表中绘制的方框和圆的填充颜色。在使用彩色打印机打印或在彩色监视器中预览报表时,也可以在 Visual Basic 中使用此属性来建立自定义报表中的特殊视觉效果。Long 型,可读/写。

expression.FillColor

expression   必需。返回“Applies To”列表中的一个对象的表达式。

说明

FillColor 属性包含一个数值表达式,该表达式用于指定所有方框和圆的填充颜色。

可以使用节的 OnPrint 事件属性指定的或 Visual Basic 事件过程来设置该属性。

可以使用 RGBQBColor 函数来设置该属性。FillColor 属性设置具有 Long 数据类型。

示例

以下示例使用 Circle 方法来绘制圆,并且在圆中创建扇形,然后使用 FillColorFillStyle 属性将扇形颜色设为红色,同时也在左上方到圆心之间画了一条直线。

若要在 Microsoft Access 中测试此示例,先新建一个报表。将主体节的“打印”属性设置为 [事件过程]。在报表模块中输入下列代码,然后切换到“打印预览”。

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