Fill Colors


I am sure this is easy but I am trying to change the color of a fill (both Pattern Color and Solid Color) but I cannot get the Solid Color to change.

Has anyone any idea how to do this in code?

For Each objfill In objsheet.DrawingObjects

            'Get the Linear color

            ccolor = objfill.FillBackground

            'Sets the color

            If ccolor = seColorGreen Then

               objfill.FillBackground = seColorBlack

            End If


Many Thanks


Posted by: Allan Anderton
Post date: 3/29/2010 1:09:00 AM


RE: Fill Colors

Some notes here:

Not all the object have the "FillBackground" property. It is something that is only present in FillStyle object.

Your previous loop would only lead in errors.

Objects in your drawing that can be "filled" are only two (someone else can correct me if i'm wrong)

- Boundary2d: This is the typical "fill" effect in a closed shape (crosshatching or filled) It is an entity itself.



I guess that you are interested in the first group.

To search your sheet for boundaries you shouldn't go through "DrawingObjects" collection, but "Boundaries2D" collection. This is much faster.

Also you have to get the Style property which returns a BoundaryStyle2D object


For each b2d in objSheet.Boundaries2d

'Get linear color


'Get fill color


'Set color would be the same thing.



'Also if you defined a fill style should set fill and linear color in one shot.




Posted by: Julian Guillo
Post date: 3/29/2010 2:44:58 AM

RE: Fill Colors


This did not work but I do have a style that if i can change should change the colors.

Does anyone have the VB code to do this for a fill style?



Posted by: Allan Anderton
Post date: 3/29/2010 3:44:13 AM

RE: Fill Colors


I finally got the fill color to work as well now as i want.



Posted by: Allan Anderton
Post date: 3/29/2010 5:58:16 AM