我在理解 Outlook 术语(CommandBarPopup、CommandBarButton 等)时遇到一些问题,例如 Outlook 中的内容,所以请耐心等待。
我想创建一些东西:
我想在消息功能区中的签名/添加附件旁边的新邮件上创建新组(或只是按钮,但我了解到无法将按钮添加到功能区中的现有组)。它的工作方式必须与 Signature 的工作方式相同,因此当您按下它时,它会显示几个选项。我该如何创建它?
我想覆盖“新建”按钮(您可以在其中选择要发送新邮件、进行约会或做其他事情),这样当您在主窗口中按下向下箭头时在新按钮旁边,您可以选择我要添加的选项之一吗?这可能吗?我该怎么做?
我有一些代码可以在主窗口中添加一个菜单
private void AddMenuBar() { try { //Define the existent Menu Bar menuBar = this.Application.ActiveExplorer().CommandBars.ActiveMenuBar; //Define the new Menu Bar into the old menu bar newMenuBar = (Office.CommandBarPopup) menuBar.Controls.Add(Office.MsoControlType.msoControlPopup, missing, missing, missing, false); //If I dont find the newMenuBar, I add it if (newMenuBar != null) { newMenuBar.Caption = "Test"; newMenuBar.Tag = menuTag; buttonOne = (Office.CommandBarButton) newMenuBar.Controls.Add(Office.MsoControlType.msoControlButton, missing, missing, 1, true); buttonOne.Style = Office.MsoButtonStyle.msoButtonIconAndCaption; buttonOne.Caption = "Test Button"; //This is the Icon near the Text buttonOne.FaceId = 610; buttonOne.Tag = "c123"; //Insert Here the Button1.Click event buttonOne.Click += new Office._CommandBarButtonEvents_ClickEventHandler(ButtonOneClick); newMenuBar.Visible = true; } } catch (Exception ex) { //This MessageBox is visible if there is an error System.Windows.Forms.MessageBox.Show("Error: " + ex.Message.ToString(), "Error Message Box", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
我想在 buttonOne 下添加子菜单,这样当我按下它时,新的子菜单就会打开。我该如何实现?
最佳答案
- 这是不可能的,因为 OOM 不会公开这种类型的按钮 :( 即使 MS 使用它。你可以隐藏一个按钮组,然后通过添加标准命令创建你自己的“相似”组,有点给你同样的事情。
编辑:用于隐藏标准操作组的 XML .. 使用其可见属性及其 idMso
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="Ribbon_Load" loadImage="GetImage">
<ribbon>
<tabs>
<tab idMso="TabReadMessage">
<group idMso="GroupActions" visible="false">
</group>
<group id="newactionsgroup" label="Actions" insertAfterMso="GroupActions">
<button idMso="Delete" size="large"/>
<button id="MoveToFolder" imageMso="MoveToFolder" size="large" label="Move To Folder" onAction="myMoveToFolder" />
<button idMso="CreateMailRule" size="large"/>
<menu idMso="OtherActionsMenu" size="large"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
- 完全不可能,尽管您可以再次隐藏现有按钮并创建具有良好位置表单的类似内容!
3.将 buttonOne 创建为 CommandBarPopup
关于c# - C# 中的 Outlook 插件 - 如何在新邮件中添加按钮/组(在签名旁边),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2375051/