Asp.Net教程,WinForm教程,Asp.Net MVC,vs2008教程,vs2010教程,Silverlight技术,源码下载,Asp.Net视频教程
全站热门标签
vs2010 Silverlight 存储过程 水晶报表 ADO.NET JavaScript LINQ AjaxPro DataGridView 面向对象 Extjs GridView XML DevExpress HTML教程 Oracle jQuery 分页 GDI+ Visual C++2010 MySQL Office2010 WPF MVC Dojo WCF4.0 VB.NET Sql2005 textbox cookie WCF WinForm Discuz!NT SQL经典语句 T-SQL checkbox ASPxGridView F# asp.net SQL VS2008新特性 DropDownList Access TreeView Ajax VS2008 页面执行时间 Flex 字符串 回调 VB2005 DataSet C#时间 ASP.NET性能优化 用户在线检测 动画
当前位置: 主页 > vs2010教程 >

Visual Studio2010开发office2010办公自动化应用(10)自定义OutlookAddIn插件

时间:2010-07-30 23:21来源:blog.csdn.net/yincheng01 作者:admin 点击:

创建一个OutlookAddInCSDN工程


创建后我们在工程里再添加一个名为"form1"的窗体,

进入form1页面加入 如图所示的各种控件:

然后在form.cs中加入下列代码:
using System;  
using System.Collections.Generic;  
using System.ComponentModel;  
using System.Data;  
using System.Drawing;  
using System.Linq;  
using System.Text;  
using System.Windows.Forms;  
 
namespace OutlookAddIn  
{  
    public partial class Form1 : Form  
    {  
        public Form1()  
        {  
            InitializeComponent();  
        }  
 
        private void 关闭_Click(object sender, EventArgs e)  
        {  
            this.Close();  
        }  
 
        private void button2_Click(object sender, EventArgs e)  
        {  
            this.richTextBox1.Clear();  
        }  
    }  

最后在ThisAddIn.cs中写入如下代码:
using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Text;  
using System.Xml.Linq;  
using Outlook = Microsoft.Office.Interop.Outlook;  
using Office = Microsoft.Office.Core;  
 
namespace OutlookAddIn  
{  
    public partial class ThisAddIn  
    {  
        private void ThisAddIn_Startup(object sender, System.EventArgs e)  
        {  
            Form1 frm = new Form1();  
            frm.Show();  
            frm.TopMost = true;  
        }  
 
        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)  
        {  
        } 
 
        #region VSTO generated code  
 
        /// <summary>  
        /// Required method for Designer support - do not modify  
        /// the contents of this method with the code editor.  
        /// </summary>  
        private void InternalStartup()  
        {  
            this.Startup += new System.EventHandler(ThisAddIn_Startup);  
            this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);  
        } 
         
        #endregion  
    }  

按下F5开始调试
 

运行界面如下,PowerPoint文档打开了以后,首先弹出备忘提醒的小插件,使您对今天重要必须要做的工作一目了然:

 

 

(责任编辑:admin)
Tags:Office2010
责任编辑:admin
返回顶部
------分隔线----------------------------
推荐内容
骆驼户外男 真皮磨砂日常休闲鞋 低帮 2011秋冬新款 专柜正品特价 骆驼户外男 真皮磨砂日常休闲鞋 低帮 2011秋冬新款 专柜正品特价