|
本帖最后由 只为设计 于 2016-6-16 12:48 编辑
- PowerPoint.Selection sel = app.ActiveWindow.Selection;
- if (sel.Type != PowerPoint.PpSelectionType.ppSelectionShapes)
- {
- forms.MessageBox.Show("请选择至少1个形状");
- }
- else
- {
- PowerPoint.ShapeRange range = sel.ShapeRange;
- if (sel.HasChildShapeRange)
- {
- range = sel.ChildShapeRange;
- }
- else
- {
- range = sel.ShapeRange;
- }
- int count = range.Count;
- if (count == 1)
- {
- if (range[1].Type == Office.MsoShapeType.msoGroup)
- {
- Random rand = new Random();
- for (int i = 1; i <= range[1].GroupItems.Count; i++)
- {
- int ran1 = rand.Next(0, 360);
- range[1].GroupItems[i].Rotation = (i - i + 1) * ran1;
- }
- }
- else
- {
- Random rand = new Random();
- int ran1 = rand.Next(0, 360);
- range[1].Rotation = ran1;
- }
- }
- else if (count >= 2)
- {
- Random rand = new Random();
- for (int i = 1; i <= range.Count; i++)
- {
- int ran1 = rand.Next(0, 360);
- range[i].Rotation = (i - i + 1) * ran1;
- }
- }
- }
复制代码
|
|