使用 FillStyle 屬性可以指定由 Circle 或 Line 方法在報表上繪制的圓或線條是否透明、不透明或使用圖案來填充。Integer 型,可讀/寫。
expression 必需。返回“應(yīng)用于”列表中的一個對象的表達(dá)式。
FillStyle 屬性使用以下設(shè)置:
設(shè)置 |
說明 |
0 |
不透明 |
1 |
(默認(rèn)值)透明 |
2 |
水平線 |
3 |
垂直線 |
4 |
由左下角到右上角的對角線 |
5 |
由左上角到右下角的對角線 |
6 |
交叉線 |
7 |
交叉的對角線 |
注釋 您可以使用節(jié)的 OnPrint 屬性設(shè)置指定的宏或 Visual Basic 事件過程來設(shè)置 FillStyle 屬性。
當(dāng) FillStyle 屬性設(shè)置為 0 時,圓或線條的顏色由 FillColor 屬性指定。當(dāng) FillStyle 屬性設(shè)置為 1 時,圓和線條的內(nèi)部是透明的,且有報表的顏色。
若要使用 FillStyle 屬性,SpecialEffect 屬性必需設(shè)置為“平面”。
以下示例使用 Circle 方法繪制圓,并且在圓中創(chuàng)建扇形,然后使用 FillColor 和 FillStyle 屬性將扇形顏色設(shè)為紅色,同時也在左上方到圓心之間畫了一條直線。
若要在 Microsoft Access 中測試此示例,請先新建一個報表。將主體節(jié)的 OnPrint 屬性設(shè)置為 [事件過程]。在報表模塊中輸入下列代碼,然后切換到“打印預(yù)覽”。
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