[英]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.