简体   繁体   English

如何使用C#在Outlook 2010中获取Office.IRibbonControl值?

[英]how to get Office.IRibbonControl value in outlook 2010 using c#?

i have developing outlook addin.i done to create a custom tab.it contains two buttons and i set a custom image successsfully.now my issue is i cant hide my button in my button click function.the ribbon and their button images are only load in ribbon load.i want to hide the first button and display the second button for after first button click. 我已经开发了Outlook addin。我创建了一个自定义选项卡。它包含两个按钮,并且成功设置了一个自定义图像。现在我的问题是我无法在按钮单击功能中隐藏我的按钮。功能区及其按钮图像仅被加载在功能区load.i中,我想隐藏第一个按钮,并在单击第一个按钮后显示第二个按钮。

<button id="btn1" onAction="Encrypt_Click" label="Encrypt" size="large" image="email-security.png" getVisible="Control_Visible"/>

 <button id="btn2" onAction="Decrypt_Click" label="Decrypt" size="large" image="email-security.png" getVisible="Decrypt_Visible" />

the functions are, 功能是

public bool Control_Visible(Office.IRibbonControl control)
        {

            cntrlID = control.Id;

            var windowType = Globals.ThisAddIn.Application.ActiveWindow();
            if (windowType is Outlook.Explorer)
            {

                return false;
            }
            else
            {
                if (flag == true)
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }


        }


 public bool Decrypt_Visible(Office.IRibbonControl control)
        {


            var windowType = Globals.ThisAddIn.Application.ActiveWindow();
            if (windowType is Outlook.Explorer)
            {

                return true;
            }
            else
            {
                if (flag == true)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }


        }

the above two functions called by ribbon load only.i want to call the functions in button click functions.how to get Office.IRibbonControl control object value to call the Decrypt_Visible() in btn1_click function. 仅由功能区加载调用的上述两个函数。我想调用按钮单击函数中的函数。如何获取Office.IRibbonControl控制对象值以调用btn1_click函数中的Decrypt_Visible()

Just use ribbon.Invalidate() in btn1_click function. 只需在btn1_click函数中使用ribbon.Invalidate()。 It calls getVisible (and other) callbacks for all controls. 它为所有控件调用getVisible(和其他)回调。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C#Office / Outlook 2010工具栏-HTML电子邮件-HTMLBody缓慢 - C# Office / Outlook 2010 Toolbar - HTML Emails - HTMLBody is slow 如何使用c#从具有MultiAccount的Outlook 2010中的“撰写邮件”窗口中的(发件人)邮件地址获取信息? - how to get from(sender) mail address in Compose mail window in outlook 2010 having MultiAccount using c#? C#Outlook插件:如何获取我自己的Office Communicator状态 - C# Outlook Plugin : How to get my own Office Communicator status 如何使用Microsoft.Office.Interop.Outlook库通过C#读取.eml文件? - How Can I use Microsoft.Office.Interop.Outlook library to read .eml file using C#? 如何在使用 Microsoft.Office.Interop.Outlook 从 C# 发送邮件时删除“代表” - How to remove "on behalf of " while sending mail from C# using Microsoft.Office.Interop.Outlook 从C#Windows服务使用Outlook Office.Interop - Using Outlook Office.Interop from a C# windows service 如何从 C# 调用 Microsoft Office Outlook 宏 - How to call a Microsoft office outlook Macro from C# 如何使用 C# 获取详细办公室品牌/产品名称 - How to get Detail Office Brand/ Product name using C# C#Outlook 2010获取完整的全局地址列表信息 - C# Outlook 2010 get FULL Global Address List Inforamtion C#在不使用Office互操作的情况下创建Outlook任务 - C# Create Outlook task without using office interop
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM