Office中国论坛/Access中国论坛
标题:
【OneKeyTools源代码分享5】随机旋转
[打印本页]
作者:
只为设计
时间:
2016-6-16 09:46
标题:
【OneKeyTools源代码分享5】随机旋转
本帖最后由 只为设计 于 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;
}
}
}
复制代码
上一篇:
OK插件综合运用之绚丽线条
下一篇:
【OneKeyTools源代码分享6】删除备注
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3