Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > Access数据库-模块/函数/VBA

FillStyle 属性

时 间:2021-01-09 08:01:25
作 者:杨雪   ID:42182  城市:南京
摘 要:使用 FillStyle 属性可以指定由 Circle 或 Line 方法在报表上绘制的圆或线条是否透明、不透明或使用图案来填充。
正 文:

使用 FillStyle 属性可以指定由 Circle 或 Line 方法在报表上绘制的圆或线条是否透明、不透明或使用图案来填充。Integer 型,可读/写。
expression.FillStyle

expression     必需。返回“应用于”列表中的一个对象的表达式。


说   明:
FillStyle 属性使用以下设置:
设置    说明
0         不透明
1       (默认值)透明
2          水平线
3          垂直线
4          由左下角到右上角的对角线
5          由左上角到右下角的对角线
6          交叉线
7          交叉的对角线


注   释:

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

当 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               '  水平居中
    sngVCtr = Me.ScaleHeight / 2              ' 垂直居中
    sngRadius = Me.ScaleHeight / 3            ' 圆的半径
    Me.Circle (sngHCtr, sngVCtr), sngRadius   ' 画圆
    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


图   示:



Access软件网QQ交流群 (群号:483923997)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助