GradientColor2 プロパティ(ActiveX)

グラデーションの終了色を指定します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.GradientColor2
object

タイプ: Hatch

このプロパティが適用されるオブジェクト。

プロパティの値

読み込み専用: いいえ

タイプ: AcCmColor

AcCmColor オブジェクトは、次の定数の 1 つを含んでいる必要があります。含んでいなければエラーが返されます。

注意

追加の注意はありません。

VBA:

Sub Example_GradientColor2()
    ' This example changes the value of the GradientColor2 property.
    
    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean
    
    ' Define the hatch
    patternName = "CYLINDER"
    PatternType = acPreDefinedGradient '0
    bAssociativity = True
    
    ' Create the associative Hatch object in model space
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity, acGradientObject)
    Dim col1 As AcadAcCmColor, col2 As AcadAcCmColor, newColor As AcadAcCmColor
    Set col1 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Set col2 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Set newColor = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col1.SetRGB 255, 0, 0
    col2.SetRGB 0, 255, 0
    newColor.SetRGB 0, 100, 0
    hatchObj.GradientColor1 = col1
    hatchObj.GradientColor2 = col2
    
    ' Create the outer boundary for the hatch (a circle)
    Dim outerLoop(0 To 0) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 3: center(1) = 3: center(2) = 0
    radius = 1
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    
    ' Append the outerboundary to the hatch object, and display the hatch
    hatchObj.AppendOuterLoop (outerLoop)
    hatchObj.Evaluate
    ThisDrawing.Regen True
    MsgBox "Initial value of GradientColor2 is :" & vbCrLf & _
                    "red = " & hatchObj.GradientColor2.Red & vbCrLf & _
                    "green = " & hatchObj.GradientColor2.Green & vbCrLf & _
                    "blue = " & hatchObj.GradientColor2.Blue

    hatchObj.GradientColor2 = newColor
    MsgBox "New value of GradientColor2 is :" & vbCrLf & _
                    "red = " & hatchObj.GradientColor2.Red & vbCrLf & _
                    "green = " & hatchObj.GradientColor2.Green & vbCrLf & _
                    "blue = " & hatchObj.GradientColor2.Blue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GradientColor2()
    ;; This example changes the value of the GradientColor2 property.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))    
    
    ;; Define the hatch
    (setq patternName "CYLINDER")
    (setq patternType acPreDefinedGradient)
    (setq bAssociativity :vlax-true)
    
    ;; Create the associative Hatch object in model space
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acGradientObject))

    (setq col1 (vlax-create-object "AutoCAD.AcCmColor.20"))
    (setq col2 (vlax-create-object "AutoCAD.AcCmColor.20"))
    (setq newColor (vlax-create-object "AutoCAD.AcCmColor.20"))

    (vla-SetRGB col1 255 0 0)
    (vla-SetRGB col2 0 255 0)
    (vla-SetRGB newColor 0 100 0)

    (vla-put-GradientColor1 hatchObj col1)
    (vla-put-GradientColor2 hatchObj col2)
    
    ;; Create the outer boundary for the hatch (a circle)
    (setq center (vlax-3d-point 3 3 0)
          radius 1)
    (setq circle (vla-AddCircle modelSpace center radius))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element outerLoop 0 circle)
    
    ;; Append the outerboundary to the hatch object, and display the hatch
    (vla-AppendOuterLoop hatchObj outerLoop)
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)
    (alert (strcat "Initial value of GradientColor2 is :"
                   "\nred = " (itoa (vla-get-Red (vla-get-GradientColor2 hatchObj)))
                   "\ngreen = " (itoa (vla-get-Green (vla-get-GradientColor2 hatchObj)))
                   "\nblue = " (itoa (vla-get-Blue (vla-get-GradientColor2 hatchObj)))))

    (vla-put-GradientColor2 hatchObj newColor)
    (alert (strcat "New value of GradientColor2 is :"
                   "\nred = " (itoa (vla-get-Red (vla-get-GradientColor2 hatchObj)))
                   "\ngreen = " (itoa (vla-get-Green (vla-get-GradientColor2 hatchObj)))
                   "\nblue = " (itoa (vla-get-Blue (vla-get-GradientColor2 hatchObj)))))

    (vlax-release-object col1)
    (vlax-release-object col2)
    (vlax-release-object newColor)
)