本文整理汇总了C#中Microsoft.Office.Core.FindControl方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Core.FindControl方法的具体用法?C# Microsoft.Office.Core.FindControl怎么用?C# Microsoft.Office.Core.FindControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Office.Core
的用法示例。
在下文中一共展示了Microsoft.Office.Core.FindControl方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCommandBarButton
private Office.CommandBarButton CreateCommandBarButton(
Office.CommandBar commandBar, string captionText, string tagText,
string tipText, Office.MsoButtonStyle buttonStyle, System.Drawing.Bitmap picture,
bool beginGroup, bool isVisible, object objBefore, Office._CommandBarButtonEvents_ClickEventHandler handler)
{
// Determine if button exists
Office.CommandBarButton aButton = (Office.CommandBarButton)
commandBar.FindControl(buttonStyle, null, tagText, null, null);
if (aButton == null)
{
// Add new button
aButton = (Office.CommandBarButton)
commandBar.Controls.Add(Office.MsoControlType.msoControlButton, 1, tagText, objBefore, true);
aButton.Caption = captionText;
aButton.Tag = tagText;
if (buttonStyle != Office.MsoButtonStyle.msoButtonCaption)
{
aButton.Picture = (IPictureDisp)AxHost2.GetIPictureDispFromPicture(picture);
}
aButton.Style = buttonStyle;
aButton.TooltipText = tipText;
aButton.BeginGroup = beginGroup;
aButton.Click += handler;
}
aButton.Visible = isVisible;
return aButton;
}
示例2: MkSMenu
/// <summary>
/// MakeSubMenu
/// </summary>
/// <param name="o">The parent menu object</param>
/// <param name="sm">The submenu caption</param>
/// <param name="tag">The tag of the submenu created</param>
/// <param name="e"></param>
/// <returns>The newly created submenu</returns>
private Office.CommandBarButton MkSMenu(Office.CommandBar o, string sm, string tag, Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler e)
{
Office.CommandBarButton f = (Office.CommandBarButton)(o.FindControl(Office.MsoControlType.msoControlButton, missing, tag, System.Type.Missing));
if (f != null)
{
f.Click -= e;
f.Delete();
f = null;
}
f = (Office.CommandBarButton)(o.Controls.Add(Office.MsoControlType.msoControlButton, missing, missing, 1, true));
f.Tag = tag;
f.accName = f.Caption = sm;
#if test
RemoveClickEvent(f);
#endif
f.Click += e;
return f;
}
示例3: SubMenuExists
private bool SubMenuExists(Office.CommandBar o, string tag)
{
Office.CommandBarButton f = (Office.CommandBarButton)o.FindControl(Office.MsoControlType.msoControlButton, missing, tag, System.Type.Missing);
return (f != null);
}
示例4: MkMenu
/// <summary>
/// another Make menu overload made for convinience
/// </summary>
/// <param name="o"></param>
/// <param name="s"></param>
/// <param name="tag"></param>
/// <returns></returns>
private Office.CommandBarPopup MkMenu(Office.CommandBar o, string s, string tag)
{
Office.CommandBarPopup f = (Office.CommandBarPopup)o.FindControl(Office.MsoControlType.msoControlPopup, missing, tag, System.Type.Missing);
if (f != null) DelPopup(f);
f = (Office.CommandBarPopup)o.Controls.Add(Office.MsoControlType.msoControlPopup, missing, missing, 1, true);
f.Tag = tag;
f.accName = f.Caption = s;
return f;
}
示例5: MenuExists
private Office.CommandBarPopup MenuExists(Office.CommandBar o, string tag)
{
Office.CommandBarPopup f = (Office.CommandBarPopup)o.FindControl(Office.MsoControlType.msoControlPopup, System.Type.Missing, tag, System.Type.Missing);
return f;
}
示例6: DisplayMenuOption
private void DisplayMenuOption(Office.CommandBar commandBar, Outlook.MAPIFolder folder)
{
try
{
var READOUT_BUTTON_ID = "READOUT_BUTTON_ID";
if (commandBar.FindControl(Tag: READOUT_BUTTON_ID) != null)
{
#if DEBUG
Util.AppLogger.WriteLine("Already exists");
#endif
return;
}
//var btnInitReadOut = (Office.CommandBarButton)commandBar.Controls.Add(Type: Office.MsoControlType.msoControlButton);
//btnInitReadOut.Tag = READOUT_BUTTON_ID;
// btnInitReadOut.Caption = "Reinitiali&ze ReadOut Key Hook";
//btnInitReadOut.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(btnInitReadOut_Click);
var btnReadOut = (Office.CommandBarButton)commandBar.Controls.Add(Office.MsoControlType.msoControlButton, missing, missing, missing, missing);
btnReadOut.Tag = READOUT_BUTTON_ID;
btnReadOut.Caption = "Read&Out";
btnReadOut.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(btnReadOut_Click);
CurrentFolder = folder;
if (folder.Items.Count <= 0)
btnReadOut.Enabled = false;
#if DEBUG
var btnDump = (Office.CommandBarButton)commandBar.Controls.Add(Type: Office.MsoControlType.msoControlButton);
btnDump.Caption = "Dump Key Hook";
btnDump.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(
(Office.CommandBarButton Ctrl, ref bool CancelDefault) => _panelManager.WriteState()
);
#endif
}
catch (Exception ex)
{
ExceptionHandler.Catch(ex);
}
}