如果不嫌速度慢的话,也可以自己写代码完成,下面代码提供一个着色小面积图案的方法:新建一工程,复制下述代码,运行后在窗口上点击鼠标左键可看到着色效果,点击圆外面会着色不完整。
程序代码:
Private Sub FillPic(obj As Object, X As Single, Y As Single, c As Long, Fc As Long)
'填充图形,这是一个函数嵌套调用,可填充小面积图形,大面积要多用一个数组再嵌套
On Error Resume Next
Dim i As Integer, x1 As Single, y1 As Single, d(3, 1) As Integer
For i = 0 To 3: d(i, 0) = 0: d(i, 1) = 0: Next
d(0, 0) = -1: d(1, 0) = 1: d(2, 1) = -1: d(3, 1) = 1 '设置步进方向
If obj.Point(X, Y) = c Then
obj.PSet (X, Y), Fc
For i = 0 To 3
x1 = X + d(i, 0)
y1 = Y + d(i, 1)
FillPic obj, x1, y1, c, Fc
Next
End If
End Sub
Private Sub Form_Load()
Me.ScaleMode = 3
Me.AutoRedraw = True
Me.Circle (35, 35), 30, vbBlack
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim c As Long
If Button = 1 Then
c = Me.Point(X, Y)
FillPic Me, X, Y, c, vbBlue
End If
End Sub