C# + Excel 2003 - 透明的自定义图标

发布于 2024-07-13 14:28:59 字数 482 浏览 2 评论 0原文

我使用以下类从我的 C# 代码生成 Excel 2003 中自定义工具栏的图标:

public class ImageConverter : System.Windows.Forms.AxHost
{
    public ImageConverter() : base("59EE46BA-677D-4d20-BF10-8D8067CB8B33")
    {
    }

    public static stdole.IPictureDisp ImageToIpicture(System.Drawing.Image image)
    {            
        return (stdole.IPictureDisp)ImageConverter.GetIPictureDispFromPicture(image);
    }
}

我的问题是如何制作透明图标? 我的所有图标都是透明的 gif,但在 Excel 2003 中它们具有纯蓝色背景。

I use following class to generate icon for custom toolbar in Excel 2003 from my C# code:

public class ImageConverter : System.Windows.Forms.AxHost
{
    public ImageConverter() : base("59EE46BA-677D-4d20-BF10-8D8067CB8B33")
    {
    }

    public static stdole.IPictureDisp ImageToIpicture(System.Drawing.Image image)
    {            
        return (stdole.IPictureDisp)ImageConverter.GetIPictureDispFromPicture(image);
    }
}

My question is how to make transparent icon? All my icons are transparent gifs, but in Excel 2003 they have solid blue background.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浪推晚风 2024-07-20 14:28:59

您需要创建一个遮罩图像并将其分配给commandbarbutton.mask。 请参阅 http://support.microsoft.com/kb/286460/ 了解更多详细信息

You need to create an mask image and assign it to commandbarbutton.mask. Refer http://support.microsoft.com/kb/286460/ for more details

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文