Previous Document Next Document

Object Model Reference : Classes : F : Fill : Properties : Fill.Type


Fill.Type

Property Type As cdrFillType

Description

Member of Fill

The Type property returns the type of the fill. Depending on the current type of the fill, one of the following fill sub-objects is available: Fill.Fountain, Fill.Hatch, Fill.Pattern, Fill.PostScript, Fill.Texture, Fill.UniformColor.

 
To change the type of fill, you should use the corresponding Apply... method of the Fill class. The exception is applying a uniform fill: assigning a color to the Fill.UniformColor property automatically sets the fill type to cdrUniformFill.

The Type property returns a read-only value.

VBA example

The following VBA example lists the number of shapes with different fills in the document.

Sub Test()
 Dim d As Document
 Dim p As Page
 Dim s As Shape
 Dim msg As String
 Dim num As Long
 Dim NoFill As Long, Uniform As Long
 Dim Fountain As Long, Pattern As Long
 Dim Texture As Long, PostScript As Long
 NoFill = 0
 Uniform = 0
 Fountain = 0
 Pattern = 0
 Texture = 0
 PostScript = 0
 num = 0
 Set d = ActiveDocument
 For Each p In d.Pages
  For Each s In p.Shapes
   Select Case s.Fill.Type
    Case cdrNoFill
     NoFill = NoFill + 1
    Case cdrUniformFill
     Uniform = Uniform + 1
    Case cdrFountainFill
     Fountain = Fountain + 1
    Case cdrPatternFill
     Pattern = Pattern + 1
    Case cdrTextureFill
     Texture = Texture + 1
    Case cdrPostscriptFill
     PostScript = PostScript + 1
   End Select
   num = num + 1
  Next s
 Next p
 msg = "The document contains " & num & " shapes with:" & vbCr
 msg = msg & "No fill: " & NoFill & vbCr
 msg = msg & "Uniform fill: " & Uniform & vbCr
 msg = msg & "Fountain fill: " & Fountain & vbCr
 msg = msg & "Pattern fill: " & Pattern & vbCr
 msg = msg & "Texture fill: " & Texture & vbCr
 msg = msg & "PostScript fill: " & PostScript
 MsgBox msg, vbInformation, "Statistics"
End Sub
Sub Test()
 Dim s As Shape
 For Each s In ActivePage.Shapes
  If s.Fill.Type = cdrPostscriptFill Then
   s.Fill.PostScript.Select "Bricks"
  End If
 Next s
End Sub
Sub Test()
 Dim s As Shape
 Dim cc As FountainColor
 For Each s In ActivePage.Shapes
  Select Case s.Fill.Type
   Case cdrUniformFill
    s.Fill.UniformColor.ConvertToGray
   Case cdrFountainFill
    s.Fill.Fountain.StartColor.ConvertToGray
    s.Fill.Fountain.EndColor.ConvertToGray
    For Each cc In s.Fill.Fountain.Colors
     cc.Color.ConvertToGray
    Next cc
  End Select
 Next s
End Sub

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.