VSTO在幻灯片里面添加按钮对象

2021年6月21日 2点热度 0条评论 来源: weixin_30483013

//添加Form窗体,窗体中添加Image控件,单击弹出"PPT"信息提示
//命名引用:using MF = Microsoft.Vbe.Interop.Forms;
private void AddOleForm(PowerPoint.Slide slide, string fileName, float left, float top, float width, float height)
{
var oleControl = slide.Shapes.AddOLEObject(left, top, width, height, "Forms.CommandButton.1", "",
Office.MsoTriState.msoFalse, "", 0, "", Office.MsoTriState.msoFalse);
var obj = oleControl.OLEFormat.Object;
oleControl.Name = "Frame";

PowerPoint.OLEFormat oleF = slide.Shapes.Range("Frame").OLEFormat;
MF.CommandButton button = (MF.CommandButton)oleF.Object;

button.Caption = "开始活动";
}

 

//点击事件

private void button_Click()
{
MessageBox.Show("下课后只能发起课后的活动!!");

}

转载于:https://www.cnblogs.com/fansb/p/7047274.html

    原文作者:weixin_30483013
    原文地址: https://blog.csdn.net/weixin_30483013/article/details/94849664
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。