asp.net c# Design Pattern WebService Windows Report Control Mobile Symbin Windows Phone 7 Visual Studio 2011
操作系统:Windows Vista
开发环境: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,falsetrue);

            
//在创建的barTopCommand上创建一个CommandBarButton
            Office.CommandBarButton button1 = barTopCommand.Controls.Add(Office.MsoControlType.msoControlButton, Type.Missing, Type.Missing, Type.Missing, trueas 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");
        }

示例文件下载
/Files/jetxia/VSTO/VSTO_MyBar.zip

Copyright © 2024 笑缘
Powered by .NET 8.0 on Kubernetes

asp.net c# Design Pattern WebService Windows Report Control Mobile Windows Phone Visual Studio
asp.net c# Design Pattern WebService Windows Report Control Mobile