Tuesday, October 25, 2011

Ungrouping graphics

Ungrouping a graphic is just a matter of setting its GroupParent property to zero.

graphic.GroupParent = 0;

The graphic being ungrouped may itself be group.  Ungrouping its members is easy, however, as when looping through all of the graphics in a frame, you find both ordinary graphics and groups.

This code ungroups any grouped graphics within an anchored frame by setting all GroupParent properties to zero.

group = doc.NewGraphicObject(Constants.FO_Group, aFrame); 
graphic = aFrame.FirstGraphicInFrame;
while (graphic.ObjectValid()) {
        graphic.GroupParent = 0;
        graphic = graphic.NextGraphicInFrame

No comments:

Post a Comment