outlook插件开发.docx
- 文档编号:24641012
- 上传时间:2023-05-29
- 格式:DOCX
- 页数:35
- 大小:1.45MB
outlook插件开发.docx
《outlook插件开发.docx》由会员分享,可在线阅读,更多相关《outlook插件开发.docx(35页珍藏版)》请在冰豆网上搜索。
outlook插件开发
向outlook2010中开发一个计算器的插件
1.开发环境介绍:
VS2010、outlook2010
2.具体步骤如下:
1)新建一个插件项目,如下图所示:
2)点击确定按钮,进入如下页面:
3)选择解决方案中的“OutlookAddIn1”右键—》添加---》新建项,如下图所示:
4)点击新建项目,进入以下页面:
5)选择“功能区(可视化设计器)”,出现如下页面
6)拖一个button控件到group1中,如下图所示:
7)新建一个winform页面命名为“Calculate”,如下图所示:
8)向Calculate页面中添加控件,设计成如下图所示的页面:
9)实现计算器的功能:
Calculate.cs文件的源代码如下:
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Windows.Forms;
namespaceOutlookAddIn1
{
publicpartialclassCalculator:
Form
{
doublea,b;
stringm;
boolflag=false;
publicCalculator()
{
InitializeComponent();
}
///
///清?
除y
///
///
///
privatevoidbtnClear_Click(objectsender,EventArgse)
{
txtValue.Text="";
}
///
///数ºy值¦Ì7
///
///
///
privatevoidbtn7_Click(objectsender,EventArgse)
{
if(txtValue.Text.Trim()!
="0")
txtValue.Text+="7";
else
txtValue.Text="7";
}
///
///数ºy值¦Ì8
///
///
///
privatevoidbtn8_Click(objectsender,EventArgse)
{
if(txtValue.Text.Trim()!
="0")
txtValue.Text+="8";
else
txtValue.Text="8";
}
///
///数ºy值¦Ì9
///
///
///
privatevoidbtn9_Click(objectsender,EventArgse)
{
if(txtValue.Text.Trim()!
="0")
txtValue.Text+="9";
else
txtValue.Text="9";
}
///
///数ºy值¦Ì4
///
///
///
privatevoidbtn4_Click(objectsender,EventArgse)
{
if(txtValue.Text.Trim()!
="0")
txtValue.Text+="4";
else
txtValue.Text="4";
}
///
///数ºy值¦Ì5
///
///
///
privatevoidbtn5_Click(objectsender,EventArgse)
{
if(txtValue.Text.Trim()!
="0")
txtValue.Text+="5";
else
txtValue.Text="5";
}
///
///数ºy值¦Ì6
///
///
///
privatevoidbtn6_Click(objectsender,EventArgse)
{
if(txtValue.Text.Trim()!
="0")
txtValue.Text+="6";
else
txtValue.Text="6";
}
///
///数ºy值¦Ì1
///
///
///
privatevoidbtn1_Click(objectsender,EventArgse)
{
if(txtValue.Text.Trim()!
="0")
txtValue.Text+="1";
else
txtValue.Text="1";
}
///
///数ºy值¦Ì2
///
///
///
privatevoidbtn2_Click(objectsender,EventArgse)
{
if(txtValue.Text.Trim()!
="0")
txtValue.Text+="2";
else
txtValue.Text="2";
}
///
///数ºy值¦Ì3
///
///
///
privatevoidbtn3_Click(objectsender,EventArgse)
{
if(txtValue.Text.Trim()!
="0")
txtValue.Text+="3";
else
txtValue.Text="3";
}
///
///点Ì?
///
///
///
privatevoidbtn10_Click(objectsender,EventArgse)
{
if(txtValue.Text.Trim()!
=""&&txtValue.Text.IndexOf('.')<=0)
txtValue.Text+=".";
}
///
///数ºy值¦Ì0
///
///
///
privatevoidbtn0_Click(objectsender,EventArgse)
{
if(txtValue.Text.Trim()!
="0")
txtValue.Text+="0";
else
txtValue.Text="0";
}
///
///等̨¨于®¨²号?
///
///
///
privatevoidbtn11_Click(objectsender,EventArgse)
{
Calculators();
}
///
///退ª?
位?
///
///
///
privatevoidbtnRemove_Click(objectsender,EventArgse)
{
stringvalue=txtValue.Text.Trim();
if(value.Length>0)
txtValue.Text=value.Substring(0,value.Length-1);
}
///
///除y号?
///
///
///
privatevoidbtn12_Click(objectsender,EventArgse)
{
Operation(btn12.Text);
}
///
///乘?
号?
///
///
///
privatevoidbtn13_Click(objectsender,EventArgse)
{
Operation(btn13.Text);
}
///
///减?
号?
///
///
///
privatevoidbtn14_Click(objectsender,EventArgse)
{
Operation(btn14.Text);
}
///
///加¨®号?
///
///
///
privatevoidbtn15_Click(objectsender,EventArgse)
{
Operation(btn15.Text);
}
///
///计?
算?
函¡¥数ºy
///
privatevoidCalculators()
{
b=Convert.ToDouble(txtValue.Text.Trim());
switch(m)
{
case("/"):
if(b!
=0)
txtValue.Text=(a/b).ToString();
else
txtValue.Text="0";
flag=false;
break;
case("X"):
txtValue.Text=(a*b).ToString();
flag=false;
break;
case("+"):
txtValue.Text=(a+b).ToString();
flag=false;
break;
case("-"):
if(b>a)
txtValue.Text="-"+(b-a).ToString();
else
txtValue.Text=(a-b).ToString();
flag=false;
break;
}
}
///
///运?
算?
符¤?
///
///
privatevoidOperation(stringstrValue)
{
if(flag)
Calculators();
a=Convert.ToDouble(txtValue.Text.Trim());
txtValue.Text="";
m=strValue;
flag=true;
}
}
}
Calculator.Desinger.cs代码如下:
namespaceOutlookAddIn1
{
partialclassCalculator
{
///
///Requireddesignervariable.
///
privateSystem.ComponentModel.IContainercomponents=null;
///
///Cleanupanyresourcesbeingused.
///
///
protectedoverridevoidDispose(booldisposing)
{
if(disposing&&(components!
=null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#regionWindowsFormDesignergeneratedcode
///
///RequiredmethodforDesignersupport-donotmodify
///thecontentsofthismethodwiththecodeeditor.
///
privatevoidInitializeComponent()
{
this.txtValue=newSystem.Windows.Forms.TextBox();
this.btn7=newSystem.Windows.Forms.Button();
this.btn8=newSystem.Windows.Forms.Button();
this.btn9=newSystem.Windows.Forms.Button();
this.btnClear=newSystem.Windows.Forms.Button();
this.btn6=newSystem.Windows.Forms.Button();
this.btn5=newSystem.Windows.Forms.Button();
this.btn4=newSystem.Windows.Forms.Button();
this.btn3=newSystem.Windows.Forms.Button();
this.btn2=newSystem.Windows.Forms.Button();
this.btn1=newSystem.Windows.Forms.Button();
this.btn11=newSystem.Windows.Forms.Button();
this.btn0=newSystem.Windows.Forms.Button();
this.btn10=newSystem.Windows.Forms.Button();
this.btnRemove=newSystem.Windows.Forms.Button();
this.btn12=newSystem.Windows.Forms.Button();
this.btn13=newSystem.Windows.Forms.Button();
this.btn14=newSystem.Windows.Forms.Button();
this.btn15=newSystem.Windows.Forms.Button();
this.SuspendLayout();
//
//txtValue
//
this.txtValue.BackColor=System.Drawing.Color.Black;
this.txtValue.Font=newSystem.Drawing.Font("宋?
体¬?
",30F,System.Drawing.FontStyle.Regular,System.Drawing.GraphicsUnit.Point,((byte)(134)));
this.txtValue.ForeColor=System.Drawing.SystemColors.Info;
this.txtValue.Location=newSystem.Drawing.Point(13,13);
this.txtValue.Multiline=true;
this.txtValue.Name="txtValue";
this.txtValue.ReadOnly=true;
this.txtValue.Size=newSystem.Drawing.Size(432,56);
this.txtValue.TabIndex=0;
this.txtValue.TextAlign=System.Windows.Forms.HorizontalAlignment.Right;
//
//btn7
//
this.btn7.Cursor=System.Windows.Forms.Cursors.Hand;
this.btn7.Font=newSystem.Drawing.Font("宋?
体¬?
",20F,System.Drawing.FontStyle.Bold,System.Drawing.GraphicsUnit.Point,((byte)(134)));
this.btn7.Location=newSystem.Drawing.Point(12,144);
this.btn7.Name="btn7";
this.btn7.Size=newSystem.Drawing.Size(70,52);
this.btn7.TabIndex=1;
this.btn7.Text="7";
this.btn7.UseVisualStyleBackColor=true;
this.btn7.Click+=newSystem.EventHandler(this.btn7_Click);
//
//btn8
//
this.btn8.Cursor=System.Windows.Forms.Cursors.Hand;
this.btn8.Font=newSystem.Drawing.Font("宋?
体¬?
",20F,System.Drawing.FontStyle.Bold,System.Drawing.GraphicsUnit.Point,((byte)(134)));
this.btn8.Location=newSystem.Drawing.Point(109,144);
this.btn8.Name="btn8";
this.btn8.Size=newSystem.Drawing.Size(70,52);
this.btn8.TabIndex=2;
this.btn8.Text="8";
this.btn8.UseVisualStyleBackColor=true;
this.btn8.Click+=newSystem.EventHandler(this.btn8_Click);
//
//btn9
//
this.btn9.Cursor=System.Windows.Forms.Cursors.Hand;
this.btn9.Font=newSystem.Drawing.Font("宋?
体¬?
",20F,System.Drawing.FontStyle.Bold,System.Drawing.GraphicsUnit.Point,((byte)(134)));
this.btn9.Location=newSystem.Drawing.Point(200,144);
this.btn9.Name="btn9";
this.btn9.Size=newSystem.Drawing.Size(70,52);
this.btn9.TabIndex=3;
this.btn9.Text="9";
this.btn9.UseVisualStyleBackColor=true;
this.btn9.Click+=newSystem.EventHandler(this.btn9_Click);
//
//btnClear
//
this.btnClear.Cursor=System.Windows.Forms.Cursors.Hand;
this.btnCl
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- outlook 插件 开发
![提示](https://static.bdocx.com/images/bang_tan.gif)