【发布时间】:2014-02-04 04:35:46
【问题描述】:
如何将自定义图像添加到选项卡和上下文菜单中的功能区按钮。
我尝试了将图像添加到功能区按钮的链接,但没有运气:-(。我正在为 Excel 设计插件。我在标题中添加了这个。
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load" loadImage="Ribbon_LoadImage">
<button id="btn2d" keytip="L" screentip="2D Visualization" supertip="2D Part Visualization" label="2D" size="large"/>
<contextMenu idMso="ContextMenuCell">
<button id="btn1" label="my label"/>
</customUI>
代码sn-p
public Bitmap Ribbon_LoadImage(IRibbonControl control)
{
switch (control.Id)
{
case "btn2": return new Bitmap(Properties.Resources.btn1);
case "btn3": return new Bitmap(Properties.Resources.btn2);
case "btn4": return new Bitmap(Properties.Resources.btn3);
case "btn5": return new Bitmap(Properties.Resources.Filter);
case "btnOpt6": return new Bitmap(Properties.Resources.Settings);
case "btnInform7": return new Bitmap(Properties.Resources.Vis);
case "btnHelpPage": return new Bitmap(Properties.Resources.Help);
}
return null;
}
请帮助我。 我正在为 Office 2010 使用 .net 4.0 c# VSTO excel 插件。
【问题讨论】: