C#–CorelDraw开发-使用递归枚举群组中的形状并更改颜色-无需取消群组,C#示例
Use a recursivity method to enumerate your shapes in your groups and change the colors. ungroup no need
public void A() { Color searchColor = app.ActivePalette.Color[2]; Color replaceColor = app.ActivePalette.Color[20]; simpe(app.ActiveSelectionRange,searchColor,replaceColor); } private void simpe(ShapeRange sr,Color searchColor,Color replaceColor) { foreach (Shape item in sr) { if(item.Type == cdrShapeType.cdrGroupShape) { ShapeRange tempSR = item.Shapes.All(); simpe(tempSR,searchColor,replaceColor); } else { if (item.Fill.UniformColor.Name == searchColor.Name) { item.Fill.ApplyUniformFill(replaceColor); } } } }