Tags: attempting, cell, changing, color, fill, foreground, group, microsoft, msdn, shape, shapeprogrammatically, software, value, visio

Changing Fill Color

On Microsoft » Microsoft Visio

10,500 words with 5 Comments; publish: Mon, 26 May 2008 11:48:00 GMT; (30078.13, « »)

I am attempting to change the fill color of the outer shape of a group shape

programmatically.

I change the value of the fill foreground cell from my program and the

change is accepted but has no effect on the fill color of the shape.

If I manually right-click on the shape and select a fill format, the fill

color changes. If I enter the same value in the shapesheet fillforeground

cell, the color doesn't change. This seems to only happen with shapes that

are a group shape...shapes that are not a group work fine.

Any ideas?

Thanks,

Chuck

All Comments

Leave a comment...

  • 5 Comments
    • Hello Chuck,

      if you change the FillForegnd cell of your group shape, nothing happens

      because the group shape itself does not have any geometries that could be

      filled. (You will not find a Geometry section in the group shape's

      ShapeSheet.)

      If you change the fill color via the GUI (toolbar or context menu of your

      group shape), Visio automatically changes the FillForegnd cell of your group

      shape AND the FillForegnd cells of all shapes inside the group.

      Possible solution: Assumed your group shape is "Sheet.1", place the

      following formula into the FillForegnd cells of all the shapes inside the

      group:

      Sheet.1!FillForegnd

      Alternative solution: Iterate programmatically through all shapes inside

      your group and set the FillForegnd value separately for each shape.

      Best regards,

      Markus

      "Chuck Cobb" <chuckcobb.ms-visio.todaysummary.com.aol.com> schrieb im Newsbeitrag

      news:%23njy%235qDEHA.1604.ms-visio.todaysummary.com.TK2MSFTNGP11.phx.gbl...

      > I am attempting to change the fill color of the outer shape of a group

      shape

      > programmatically.

      > I change the value of the fill foreground cell from my program and the

      > change is accepted but has no effect on the fill color of the shape.

      > If I manually right-click on the shape and select a fill format, the fill

      > color changes. If I enter the same value in the shapesheet fillforeground

      > cell, the color doesn't change. This seems to only happen with shapes

      that

      > are a group shape...shapes that are not a group work fine.

      > Any ideas?

      > Thanks,

      > Chuck

      >

      #1; Mon, 26 May 2008 11:49:00 GMT
    • Thanks, Markus...I appreciate your help. I suppose I will have to iterate

      through the individual cells in the group to change the fill format.

      I have a related question...when a user applies a shadow to the outer group

      via Visio, the shadow gets applied not only to the outer group (which is

      what I want), but also gets applied to all the inner shapes within the

      group. Is there a way I can prevent that from happening? It creates this

      rather strange looking shape that has shadows within the shape as well as

      shadows outside the shape.

      Thanks,

      Chuck

      "Markus Breugst" <SorryNoEmail_TooMuchSpam> wrote in message

      news:uIbfh0yDEHA.3716.ms-visio.todaysummary.com.TK2MSFTNGP10.phx.gbl...

      > Hello Chuck,

      > if you change the FillForegnd cell of your group shape, nothing happens

      > because the group shape itself does not have any geometries that could be

      > filled. (You will not find a Geometry section in the group shape's

      > ShapeSheet.)

      > If you change the fill color via the GUI (toolbar or context menu of your

      > group shape), Visio automatically changes the FillForegnd cell of your

      group

      > shape AND the FillForegnd cells of all shapes inside the group.

      > Possible solution: Assumed your group shape is "Sheet.1", place the

      > following formula into the FillForegnd cells of all the shapes inside the

      > group:

      > Sheet.1!FillForegnd

      > Alternative solution: Iterate programmatically through all shapes inside

      > your group and set the FillForegnd value separately for each shape.

      > Best regards,

      > Markus

      > "Chuck Cobb" <chuckcobb.ms-visio.todaysummary.com.aol.com> schrieb im Newsbeitrag

      > news:%23njy%235qDEHA.1604.ms-visio.todaysummary.com.TK2MSFTNGP11.phx.gbl...

      > shape

      fill

      fillforeground

      > that

      >

      #2; Mon, 26 May 2008 11:50:00 GMT
    • Well, the shadow problem is really strongly related to the fill color

      problem: If you define a shadow of a group shape via the GUI, Visio applies

      it separately to all sub shapes. Thus, the result is a separate shadow for

      each shape inside the group.

      I don't know your shapes, but perhaps you should combine them using the

      operations provided in the menu "Shape -> Operations" rather then by

      grouping them. The result of such a shape operation is still a single(!)

      shape and not a group consisting of multiple shapes. Thus, you will have a

      single fill color, a single shadow etc.. (However, the drawback is that such

      a combined shape (like every other singel shape) can only have one color,

      shadow, ...)

      If your sub shapes need to have different colors and/or line appearances,

      you cannot realize them with these shape operations. In this case, in order

      to achieve a "group shadow" instead of single shadows, try the following:

      1.) Select your group.

      2.) Create a copy of your group (Ctrl+C, Ctrl+V).

      3.) Select the copy of the group.

      4.) Invoke the menu item "Shape -> Operations -> Union". The result will be

      a shape whose outline is a combination of the outlines of your single group

      shapes

      5.) Invoke the context menu item "Shape -> Send to back" on the union shape.

      6.) Define a shadow for the union shape.

      6.) Move the union shape over (or better: behind) your original group shape.

      7.) Select them all (the original group and the union shape) and group them.

      Hope this is the result you wanted to have.

      Best regards,

      Markus

      "Chuck Cobb" <chuckcobb.ms-visio.todaysummary.com.aol.com> schrieb im Newsbeitrag

      news:e3RbDnzDEHA.2768.ms-visio.todaysummary.com.tk2msftngp13.phx.gbl...

      > Thanks, Markus...I appreciate your help. I suppose I will have to iterate

      > through the individual cells in the group to change the fill format.

      > I have a related question...when a user applies a shadow to the outer

      group

      > via Visio, the shadow gets applied not only to the outer group (which is

      > what I want), but also gets applied to all the inner shapes within the

      > group. Is there a way I can prevent that from happening? It creates this

      > rather strange looking shape that has shadows within the shape as well as

      > shadows outside the shape.

      > Thanks,

      > Chuck

      > "Markus Breugst" <SorryNoEmail_TooMuchSpam> wrote in message

      > news:uIbfh0yDEHA.3716.ms-visio.todaysummary.com.TK2MSFTNGP10.phx.gbl...

      be

      your

      > group

      the

      > fill

      > fillforeground

      >

      #3; Mon, 26 May 2008 11:51:00 GMT
    • ... And perhaps lock the shadow patterns on all of the sub-shapes, except

      the Unioned shape, so that if users apply a shadow, they won't be back at

      the original problem.

      ShdwPattern = Guard(0)

      Hope this helps,

      Chris Roth

      Visio MVP

      "Markus Breugst" <SorryNoEmail_TooMuchSpam> wrote in message

      news:eCm%23S20DEHA.688.ms-visio.todaysummary.com.tk2msftngp13.phx.gbl...

      > Well, the shadow problem is really strongly related to the fill color

      > problem: If you define a shadow of a group shape via the GUI, Visio

      applies

      > it separately to all sub shapes. Thus, the result is a separate shadow for

      > each shape inside the group.

      > I don't know your shapes, but perhaps you should combine them using the

      > operations provided in the menu "Shape -> Operations" rather then by

      > grouping them. The result of such a shape operation is still a single(!)

      > shape and not a group consisting of multiple shapes. Thus, you will have a

      > single fill color, a single shadow etc.. (However, the drawback is that

      such

      > a combined shape (like every other singel shape) can only have one color,

      > shadow, ...)

      > If your sub shapes need to have different colors and/or line appearances,

      > you cannot realize them with these shape operations. In this case, in

      order

      > to achieve a "group shadow" instead of single shadows, try the following:

      > 1.) Select your group.

      > 2.) Create a copy of your group (Ctrl+C, Ctrl+V).

      > 3.) Select the copy of the group.

      > 4.) Invoke the menu item "Shape -> Operations -> Union". The result will

      be

      > a shape whose outline is a combination of the outlines of your single

      group

      > shapes

      > 5.) Invoke the context menu item "Shape -> Send to back" on the union

      shape.

      > 6.) Define a shadow for the union shape.

      > 6.) Move the union shape over (or better: behind) your original group

      shape.

      > 7.) Select them all (the original group and the union shape) and group

      them.

      > Hope this is the result you wanted to have.

      > Best regards,

      > Markus

      > "Chuck Cobb" <chuckcobb.ms-visio.todaysummary.com.aol.com> schrieb im Newsbeitrag

      > news:e3RbDnzDEHA.2768.ms-visio.todaysummary.com.tk2msftngp13.phx.gbl...

      iterate

      > group

      this

      as

      happens

      > be

      > your

      > the

      inside

      group

      the

      shapes

      >

      #4; Mon, 26 May 2008 11:52:00 GMT
    • Thanks, Chris...

      Guarding that cell did the job.

      "Chris Roth" <visioguy.ms-visio.todaysummary.com.hotmail.com> wrote in message

      news:eIebmECEEHA.3256.ms-visio.todaysummary.com.TK2MSFTNGP09.phx.gbl...

      > ... And perhaps lock the shadow patterns on all of the sub-shapes, except

      > the Unioned shape, so that if users apply a shadow, they won't be back at

      > the original problem.

      > ShdwPattern = Guard(0)

      > --

      > Hope this helps,

      > Chris Roth

      > Visio MVP

      >

      > "Markus Breugst" <SorryNoEmail_TooMuchSpam> wrote in message

      > news:eCm%23S20DEHA.688.ms-visio.todaysummary.com.tk2msftngp13.phx.gbl...

      > applies

      for

      a

      > such

      color,

      appearances,

      > order

      following:

      > be

      > group

      > shape.

      > shape.

      > them.

      > iterate

      is

      > this

      > as

      > happens

      could

      your

      inside

      > inside

      > group

      > the

      shape.

      the

      > shapes

      >

      #5; Mon, 26 May 2008 11:53:00 GMT