在Ribbon中使用自定义图像。

实现环境:Visual Studio 2010, Office 2010, VSTO 4.0

<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad=
"Ribbon_Load">
  <ribbon>
    <tabs>
      <tab idMso="TabAddIns">
        <group id="MyGroup"
               label="ExcelTemplate1">
          <button id="Test1" label ="Test1" getImage ="GetImage" size ="large"/>
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

        public Bitmap GetImage(Office.IRibbonControl Control)
        {
            switch(Control.Id)
            {
                case "Test1":
                    return new Bitmap(Properties.Resources.Image1);
                default :
                    return new Bitmap(Properties.Resources.Image1);
            }
        }


你可能感兴趣的:(自定义)