也许有一天 发表于 2020-5-25 18:15:33

VB新手请教问题,我想把填充颜色改成其他颜色,且不再是渐变色,该如何改动,谢谢



Dim obj_hatch As Object
Dim PatternType As Integer
Dim GradientName As String
Dim GradientColor1 As Integer, GradientColor2 As Integer
Dim AssociativeHatch As Boolean
Dim outerloop(0 To 0) As Object, innerloop(0 To 0) As Object
Dim aloop As Variant
Dim obj_circle1 As Object, obj_circle2 As Object
Dim center(0 To 2) As Double
Dim color As Object


center(0) = 5#: center(1) = 5#: center(2) = 0#
Set obj_circle1 = obj_ModelSpace.AddCircle(center, 5)
Set obj_circle2 = obj_ModelSpace.AddCircle(center, 2.5)
PatternType = 0
GradientName = "SPHERICAL"
AssociativeHatch = True
Set outerloop(0) = obj_circle1
Set innerloop(0) = obj_circle2

Set obj_hatch = obj_ModelSpace.AddHatch(PatternType, GradientName, AssociativeHatch, 1)
obj_hatch.AppendOuterLoop outerloop
obj_hatch.AppendInnerLoop innerloop

Set color = obj_Acad.GetInterfaceObject("AutoCAD.AcCmColor.16")
color.SetRGB 255, 0, 0
obj_hatch.GradientColor1 = color
color.SetRGB 0, 255, 0
obj_hatch.GradientColor2 = color
obj_hatch.Evaluate
obj_Acad.ZoomExtents


页: [1]
查看完整版本: VB新手请教问题,我想把填充颜色改成其他颜色,且不再是渐变色,该如何改动,谢谢