背景:我正在使用C#在VS2010中开发Outlook 2007加载项.我正在做的具体事情是将菜单项添加到与电子邮件关联的上下文菜单中.我使用以下代码执行此操作:
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Application.ItemContextMenuDisplay += Application_ItemContextMenuDisplay;
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
private void Application_ItemContextMenuDisplay(Office.CommandBar commandBar, Outlook.Selection selection)
{
var cmdButtonCallContact = (Office.CommandBarButton)commandBar.Controls.Add(Office.MsoControlType.msoControlButton, 1, System.Reflection.Missing.Value, 6, System.Reflection.Missing.Value);
cmdButtonCallContact.Caption = "&Foo";
//cmdButtonCallContact.Picture = ?
cmdButtonCallContact.Click += cmdButtonCopy_Click;
}
private void cmdButtonCopy_Click(Office.CommandBarButton ctrl, ref bool canceldefault)
{
System.Windows.Forms.MessageBox.Show("Bar");
}
Run Code Online (Sandbox Code Playgroud)
问题:似乎无法设置图片.Msdn示例依赖于我没有的AxHost转换函数.是否有一种简单的方法可以将图像或BitMap设置为图片?
谢谢.
我是Can Access编程语言的新手.在某些文档中,CAPL被描述为脚本.任何人都可以解释,为什么它被称为脚本?是编程还是脚本?
每当我的C#项目中需要新的应用程序设置时,我都会通过PROJECT - > Properties - > Settings添加它.目前我的C#项目中有大约20个应用程序设置,但是它们不正常.
为了能够在运行时更改设置,我通过迭代设置创建了一个简单的设置面板.
foreach (System.Configuration.SettingsProperty prop in Properties.Settings.Default.Properties)
{
Label caption = new Label();
caption.Text = prop.Name;
caption.Location = new Point(10, this.Height - 70);
caption.Size = new Size(100, 13);
caption.Anchor = AnchorStyles.Left | AnchorStyles.Top;
TextBox textbox = new TextBox();
textbox.Name = prop.Name;
textbox.Text = Properties.Settings.Default[prop.Name].ToString();
textbox.Location = new Point(120, this.Height - 70);
textbox.Size = new Size(this.Width - 140, 23);
textbox.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
if (prop.IsReadOnly)
textbox.ReadOnly = true;
this.Height += …Run Code Online (Sandbox Code Playgroud)