Office Addin开发中,自定义工具栏CommandBarButton.Picture 属性的应用

CommandBar (漂亮的.net菜单工具栏) 立即下载

转载请注明出处:
原创作者: Jaron , 优快云 IIS技术版主 2007/9/29
- 优快云
- 佳融软件

在Office Addins 开发中,经常需要自定义工具栏,工具栏图标可以使用FaceID属性设置,如果要设置自定义的图标,则需要使用CommandBarButton.Picture 属性,以下代码演示如何使用这个属性引用自定义图标。

将下列代码文件保存为 ImageConverter.cs

using  System;
using  System.Collections.Generic;
using  System.Text;

namespace  JaronSoft.Outlook.Utility
{
    
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);
        }


        
public static System.Drawing.Image IPictureToImage(stdole.StdPicture picture)
        
{
            
return ImageConverter.GetPictureFromIPicture(picture);
        }

    }
 
}

初始化CommandBarButton时,可使用以下方法。注意:图片文件格式为 16*16 像素 256色的BMP图片。

MSOffice.CommandBarButton btn;
btn.Style 
=  Microsoft.Office.Core.MsoButtonStyle.msoButtonIconAndCaption;
btn.Picture 
=  ImageConverter.ImageToIPicture(Properties.Resources.ICON_AboutUs);

【Claude】Invalid model / Opus not available 错误:模型不可用的原因 bug报错已解决 使用 Claude API 时,指定错误或不可用的模型 ID 会收到 Invalid model 错误。本文从模型命名规则出发,给出模型降级链与动态选择方案。 阅读详情

相关推荐

cesium 高程数据使用

cesium 高程数据使用高程数据下载高程数据切片简单数据服务 高程数据下载 使用地理空间数据云平台免费提供的高程数据。地理空间云平台 点击列表中的下载得到数据压缩包。例如:ASTGTM2_N22E114.zip 高程数据切片 使用cesium实验室工具对下载得到的压缩包进行切片。cesium实验室 切片得到的文件夹目录。 简单数据服务 使用nodejs的koa启动简单的资源服务。koajs 项目根目录新建data文件夹,在新建dem文件夹放高程数据。 注意目录自行更换,这里是./data/dem

哎哟这个凉白白的博客 1813

在 Microsoft Office 系统的命令栏中罗列按钮表面

 摘要:探究托管 Office 解决方案的代码,该代码显示了可用于 Microsoft Office 系统命令栏的所有按钮表面。了解如何在托管代码中使用命令栏对象模型,同时使解决方案可以跨版本兼容。最终的解决方案显示了所有可用的 Office 命令栏按钮表面和 faceIDs(一个对开发自定义命令栏非常有用的工具)。本页内容简介创建外接程序

玄鐵劍 的專欄 1504

别再手动配网了!用安信可PB-02模组+PHY Mesh App,5分钟搞定蓝牙Mesh智能灯群控

本文详细介绍了如何使用安信可PB-02模组和PHY Mesh App快速搭建蓝牙Mesh智能灯群控系统。通过5分钟的硬件连接和固件烧录,用户可实现多灯分组控制、场景切换及地理围栏等高级功能,显著提升智能家居部署效率。方案特别适合需要快速实现灯光群控的场景。

weixin_28675839的博客 420

Python——迭代器详解(全是干货)

学习目标 学习迭代器是为了学习生成器,学习生成器是为了学习协程,协程就是实现多任务的一种方式 知道什么是可迭代对象,能够使用isinstance检测对象是否可迭代 知道使用iter函数可以获取可迭代对象的迭代器 知道使用next函数可以获得迭代器数据 1. 可迭代对象 (1)迭代的意思就是遍历的意思,所以可迭代即为可遍历 (2)常见的可遍历的对象:列表List,元组tuple,字符串,字典,range (3)一般不可遍历的对象:数字、和自定义myclass(默认) (4)myclass对

weixin_44441131的博客 3649

F5 Shape盾JSVMP核心检测点与无限并发Header生成实战(TikTok/航司)

本文深入剖析了F5 Shape盾结合JSVMP技术的核心风控机制,详细解读了其针对浏览器指纹、行为时序等多维度的检测逻辑。通过实战案例,分享了如何通过逆向分析、精准Hook关键检测点,并构建稳定、高并发的请求Header生成方案,以应对TikTok、航司等平台的高级反爬挑战。

weixin_29325007的博客 1014

别再被坑了!手把手教你从官网下载免费正版Notepad++(附最新网盘链接)

本文详细指导如何从Notepad++官网安全下载正版软件,避免山寨版本带来的安全风险。通过识别官网特征、推荐官方下载渠道、揭露山寨网站骗局及验证正版功能,帮助用户高效获取纯净的Notepad++代码编辑器,并分享实用插件和配置优化技巧。

weixin_42527654的博客 571

Office Word Excel PPT Addin 插件开发

开发 office插件的 主要有 微软官方支持的 VSTO(Visual Studio Tools for Office)或者 Office add-ins 方式,通过插件的方式为大部分办公人员提供插件,提高工作效率是一种杰出的软件共享方式 自定义UI 右侧项目上右击,添加新建项,选择功能区,添加名字即可。 添加成功后,便可以按照可视化界面拖拽,双击定义操作等进行功能开发 文档查找和替换 开始自定义功能区 NetOffice GitHub 地址https://github.com/N...

ejinxian的专栏 1699

Ollama+FAISS+Embedding+Rerank+LLM 详细部署指南

下载安装Ollama 双击运行安装程序 安装完成后会自动启动服务 修改默认安装路径(避免C盘爆满) 或使用PowerShell: 验证安装 Linux系统部署: (二)准备模型 1. 拉取Embedding模型 2. 拉取LLM模型 注意:原文中提到的可能需要从自定义仓库拉取: 3. 下载Rerank模型 (三)安装依赖库 创建项目目录和虚拟环境: 二、主要功能实现 项目结构 (一)配置文件(config/config.yaml) (二)文本分块策略实现 创建 : (三)文档读取

AI技术改变世界 1589

C++开发Office插件:实现Word插件

简介本文以Word插件为例,介绍如何使用C++实现一个完整的Office插件。简单来说Office插件就是一个实现了IDTExtensibility2和IRibbonExtensibility两个接口的COM组件。IDTExtensibility2提供了Office插件接口,IRibbonExtensibility提供了Ribbon界面接口。下面详细介绍实现步骤。本例的开发环境为:Win8 + VS

Cynhard的专栏 2万+

2024年全国大学生电子设计竞赛A题_AC-AC变换电路并联运行

AC-AC变换电路并联运行(A 题)【本科组】

qq_74395263的博客 7846

如何处理NC数据?(Python和IDL语言实现)

如何处理NC数据?(Python和IDL语言实现) NetCDF(network Common Data Form)网络通用数据格式是一种面向数组型并适于网络共享的数据的描述和编码标准。目前,NetCDF广泛应用于大气科学、水文、海洋学、环境模拟、地球物理等诸多领域。用户可以借助多种方式方便地管理和操作 NetCDF 数据集。(参考自:https://zhuanlan.zhihu.com/p/129351199) 在我看来,nc和hdf有异曲同工之妙,我用的数据以hdf结构为主(HDF:层次文件格式,相当于

zhanglingfeng1的博客 4638

Outlook addon CommandBarButton picture 的不透明效果解决方案

系统中添加了一个menu icon,icon是不规则图形,显示的效果,后面有灰色的背景。 解决方案见ms support, 主要需要添加一个遮罩效果,即CommandBarButton 的Mask属性 转载于:https://www.cnblogs.com/Sailorlee/archive/2009/06/10/1500308.html...

weixin_34007291的博客 121

提示词编写:从新手到专家的进阶之路

本文旨在为提示词编写者提供一条从新手到专家的进阶之路。我们将详细探讨提示词编写的背景与意义、基础与进阶技巧、实战应用以及最佳实践。通过逐步深入的分析与实操,读者将掌握提示词编写的核心要点,提高编写效率和作品质量。提示词是用于引导人工智能生成文本的关键词或短语,它包含了作者想要传达的主题、情感和细节。随着人工智能技术的普及,自动化写作工具逐渐应用于各行各业。为了提高写作效率,项目团队决定开发一款基于人工智能的自动化写作工具。成功开发了一款自动化写作工具,生成文本质量较高。

AI天才研究院 1087

Extending Word with VSTO 2005 – Adding icons to toolbars and menus

Both menus and toolbars are in fact CommandBar controls, and when you add child controls to a CommandBar you have the option to add the following type of controls: MsoControlType.msoControlAct...

weixin_30763397的博客 212

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

微软菜单栏内置图标ID(CommandBarButton FaceId Property)

Visual StudioTools for Office CommandBarButton FaceId Property 图标右侧的数字是要使用的相应FaceId:Icons 0000 - 2999 Outlook FaceId 3000 – 3999 Referenc...

醉逍遥的博客 7716

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

Image与stdole.IPictureDisp 互转

若找不到stdole引用,应添加C:\Program Files\Microsoft.NET\Primary Interop Assemblies\stdole.dll using System.Windows.Forms; using System.Drawing; internal class AxHostCoverter:AxHost     {         p

u012859921的博客 1109

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

VBA自定义菜单和菜单栏

在EXCEL中,我们的操作都是通过“工具栏、菜单栏、快捷菜”单实现。EXCEL通过菜单给我们提供基本操作功能之外,也为我们提供了扩展自定义功能的接口,即自定义自己的工具栏、菜单栏。 本文着重介绍如何在 Excel 2003版本中通过编程方式自定义菜单和菜单栏方法。其中包含Excel 中管理和自定义菜单栏、菜单、命令、子菜单和快捷菜单,我将通过代码实例分步说明。 与大家分享关于VBA实现菜单栏管

马靖的个人技术博客 9365

outlook添加CommandBar和CommandBarButton

如果您不明白 CommandBar和CommandBarButton,建议您看看office编程。看一些概念性的东西。虽然是vba的,但是照猫画虎还是可以的。添加CommandBar/// /// 添加bar(小荷扬扬原创) /// public class Addbar { CommandBar bar

SeekArt 1268

C#Word开发,VSTO中自定义右键菜单,CommandBarButton的Click事件不触发,或者只触发一次

在做VSTO开发时,对右键菜单进行自定义,添加自定义按钮。 新疆按钮代码如下: /// &lt;summary&gt; /// 初始化自定义弹出菜单 /// &lt;/summary&gt; private void InitPopupMenu() { var textBar = Off...

球的博客 5435

Font与IFontDisp转化,Image与IPictureDisp转化

下面是AE提供的可以转化Font和Image分别为IFontDisp和IPictureDisp的函数,和我自己写的将IFontDisp和IPictureDisp转化为Font和Image的函数。 ESRI.ArcGIS.ADF.COMSupport.OLE.GetIFontDispFromFont ESRI.ArcGIS.ADF.COMSupport.OLE.GetIPictureDi...

iteye_3992的博客 642

【VSTO】创建 Excel 2007 AddIn (1. CommandBar 以及如何自定义Icon)

之前写过不少VBA来提高工作效率(比如:批量进行设计书格式化等等),但到了Office2007上,VBA就风光不再了,由于安全方面的考虑,VBA需要支持启动宏的Excel(扩展名:xlsm)才能使用。MS推出了VSTO(Visual Studio Tools for Office)来取代VBA,当你熟练掌握VSTO,你会发现它要比VBA开发更快捷——有Office AddIn接口支持,”后台”更强

Lullaby's Blog 1万+
上一篇: Web管理IIS软件更新了...
下一篇: 2007年12月15日 结婚!兄弟们有要祝贺我的吗?
Jaron
博客等级 码龄25年 170粉丝 49原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值