使用 FillStyle 属性可以指定由 Circle 或 Line 方法在报表上绘制的圆或线条是否透明、不透明或使用图案来填充。Integer 型,可读/写。
expression.FillStyle
expression 必需。返回“Applies To”列表中的一个对象的表达式。
FillStyle 属性使用以下设置:
| 设置 | 说明 | 
|---|---|
| 0 | 不透明 | 
| 1 | (默认值)透明 | 
| 2 | 水平线 | 
| 3 | 垂直线 | 
| 4 | 由左下角到右上角的对角线 | 
| 5 | 由左上角到右下角的对角线 | 
| 6 | 交叉线 | 
| 7 | 交叉的对角线 | 
当 FillStyle 属性设置为 0 时,圆或线条的颜色由 FillColor 属性指定。当 FillStyle 属性设置为 1 时,圆和线条的内部是透明的,且有报表的颜色。
若要使用 FillStyle 属性,SpecialEffect 属性必需设置为“平面”。
以下示例使用 Circle 方法绘制圆,并且在圆中创建扇形,然后使用 FillColor 和 FillStyle 属性将扇形颜色设为红色,同时也在左上方到圆心之间画了一条直线。
若要在 Microsoft Access 中测试此示例,请先新建一个报表。将主体节的 OnPrint 属性设置为 [事件过程]。在报表模块中输入下列代码,然后切换到“打印预览”。
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