使用VS2008进行VSTO-Addin实战开发-创建自己的工具栏(二)
来源:互联网 发布:windows phone安装apk 编辑:程序博客网 时间:2024/06/06 12:26
http://www.cnblogs.com/jetxia/archive/2007/09/29/910341.html
操作系统:Windows Vista
开发环境:Visual Studio 2008 Beta2
运行环境:Microsoft office 2007(Outlook)
代码主要示例了如何创建工具栏,以及在工具栏上添加按钮和按钮的Click事件。
开发环境:Visual Studio 2008 Beta2
运行环境:Microsoft office 2007(Outlook)
代码主要示例了如何创建工具栏,以及在工具栏上添加按钮和按钮的Click事件。
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
this.AddBar();
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
private void AddBar()
{
//创建一个TopBar
Office.CommandBar barTopCommand = this.Application.ActiveExplorer().CommandBars.Add("My Top Command", Office.MsoBarPosition.msoBarTop,false, true);
//在创建的barTopCommand上创建一个CommandBarButton
Office.CommandBarButton button1 = barTopCommand.Controls.Add(Office.MsoControlType.msoControlButton, Type.Missing, Type.Missing, Type.Missing, true) as Office.CommandBarButton;
button1.Caption = "My Button";
button1.Visible = true;
//添加button1的Click事件
button1.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(button1_Click);
}
void button1_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
{
MessageBox.Show("Hello button1");
}
{
this.AddBar();
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
private void AddBar()
{
//创建一个TopBar
Office.CommandBar barTopCommand = this.Application.ActiveExplorer().CommandBars.Add("My Top Command", Office.MsoBarPosition.msoBarTop,false, true);
//在创建的barTopCommand上创建一个CommandBarButton
Office.CommandBarButton button1 = barTopCommand.Controls.Add(Office.MsoControlType.msoControlButton, Type.Missing, Type.Missing, Type.Missing, true) as Office.CommandBarButton;
button1.Caption = "My Button";
button1.Visible = true;
//添加button1的Click事件
button1.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(button1_Click);
}
void button1_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
{
MessageBox.Show("Hello button1");
}
- 使用VS2008进行VSTO-Addin实战开发-创建自己的工具栏(二)
- VS2008-Addin开发-笔记
- Excel AddIn 开发(二)
- 【VSTO】创建 Excel 2007 AddIn (2. 使用 Ribbon 和自定义Pane View)
- MFC创建自己的工具栏(SDI)
- 制作VSTO 2005 SE开发的Office 2007 AddIn的安装包
- 开发VS2008 AddIn 入门Sample
- 使用Eclipse RCP进行桌面程序开发(二):菜单、工具栏和对话框
- 使用Eclipse RCP进行桌面程序开发(二):菜单、工具栏和对话框
- 使用Eclipse RCP进行桌面程序开发(二):菜单、工具栏和对话框
- 使用Eclipse RCP进行桌面程序开发(二):菜单、工具栏和对话框
- 使用Eclipse RCP进行桌面程序开发(二):菜单、工具栏和对话框
- 【Windows Mobile开发系列 之 开始二】使用VS2008进行Windows Mobile开发环境的搭建
- Windows Mobile开发系列 之 开始二】使用VS2008进行Windows Mobile开发环境的搭建
- VS2008 工具栏CMFCToolBar的使用总结(转)
- VS2008 工具栏CMFCToolBar的使用总结
- VS2008 工具栏CMFCToolBar的使用总结
- VS2008 工具栏CMFCToolBar的使用总结
- frameset, iframe, frame框架页面出现横向滚动条bug的隐藏方法
- 如何查看linux版本
- 提高工作效率的思考(Vxworks和Tornado下的杂乱联想)
- javascript完美层拖动,并且可以保存数据.
- 拾海星的故事
- 使用VS2008进行VSTO-Addin实战开发-创建自己的工具栏(二)
- 华硕 F9E F9G233E-SL的详细参数
- (转).net web开发技术路线图
- java 中如何调用vc++的dll
- strace命令详解
- 《史记》故事
- VC常用代码之动态加载DLL
- 毕业了 选择自己的路
- 访问修饰符