本文整理汇总了C#中System.Windows.Forms.CommandBarButton类的典型用法代码示例。如果您正苦于以下问题:C# CommandBarButton类的具体用法?C# CommandBarButton怎么用?C# CommandBarButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommandBarButton类属于System.Windows.Forms命名空间,在下文中一共展示了CommandBarButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateToolbar
private void CreateToolbar()
{
try
{
toolBar = FindBar()
?? Application.ActiveExplorer().CommandBars.Add(MenuToolbarTag, MsoBarPosition.msoBarTop, false, true);
toolBarButton = (CommandBarButton)toolBar.Controls.Add(MsoControlType.msoControlButton, missing, missing, 1, true);
toolBarButton.Style = MsoButtonStyle.msoButtonIconAndCaption;
toolBarButton.Caption = "Generate Distribution List";
toolBarButton.FaceId = 65;
toolBarButton.Tag = MenuToolbarTag;
toolBarButton.Click += (CommandBarButton ctrl, ref bool @default) =>
{
MainWindow window = new MainWindow(
"NNVDC01",
"OU=Sites,OU=Company,DC=domain,DC=corp",
"OU=Sites,OU=Company,DC=domain,DC=corp");
window.Show();
};
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message, "Error Message");
}
}
示例2: FDMenus
public FDMenus(IMainForm mainForm)
{
// modify the view menu
CommandBarMenu viewMenu = mainForm.GetCBMenu("ViewMenu");
View = new CommandBarButton("&Project Explorer");
View.Image = Icons.Project.Img;
viewMenu.Items.Add(View);
// modify the tools menu - add a nice GUI classpath editor
GlobalClasspaths = new CommandBarButton("&Global Classpaths...");
GlobalClasspaths.Shortcut = Keys.F9 | Keys.Control;
mainForm.IgnoredKeys.Add(GlobalClasspaths.Shortcut);
CommandBarMenu toolsMenu = mainForm.GetCBMenu("ToolsMenu");
toolsMenu.Items.AddSeparator();
toolsMenu.Items.Add(GlobalClasspaths);
ProjectMenu = new ProjectMenu();
CommandBar mainMenu = mainForm.GetCBMainMenu();
mainMenu.Items.Insert(5, ProjectMenu);
RecentComboBox = RecentComboBox.Create();
CommandBar toolBar = mainForm.GetCBToolbar();
if (toolBar != null) // you might have turned off the toolbar
{
toolBar.Items.AddSeparator();
toolBar.Items.Add(ProjectMenu.TestMovie);
toolBar.Items.Add(RecentComboBox);
}
}
示例3: ProjectMenu
public ProjectMenu()
{
NewProject = new CommandBarButton("&New Project..");
NewProject.Image = Icons.NewProject.Img;
OpenProject = new CommandBarButton("&Open Project..");
CloseProject = new CommandBarButton("&Close Project");
TestMovie = new CommandBarButton("&Test Movie");
TestMovie.Image = Icons.GreenCheck.Img;
BuildProject = new CommandBarButton("&Build Project");
BuildProject.Image = Icons.Gear.Img;
Properties = new CommandBarButton("&Properties");
Properties.Image = Icons.Options.Img;
base.Text = "&Project";
base.Items.Add(NewProject);
base.Items.Add(OpenProject);
base.Items.Add(CloseProject);
base.Items.AddSeparator();
base.Items.Add(TestMovie);
base.Items.Add(BuildProject);
base.Items.AddSeparator();
base.Items.Add(Properties);
}
示例4: CreateLoginToolWindow
public static void CreateLoginToolWindow(CommandBarControl cmdBarCtrl,
CommandBarButton cmdBarBtn, Assembly addIn_Assembly,
CommandBarControl cmdBarCtrlBackup, CommandBarControl dbCreateDemoDbControl)
{
try
{
m_AddIn_Assembly = addIn_Assembly;
m_cmdBarCtrlConnect = cmdBarCtrl;
m_cmdBarBtnConnect = cmdBarBtn;
m_cmdBarCtrlBackup = cmdBarCtrlBackup;
m_cmdBarCtrlCreateDemoDb = dbCreateDemoDbControl;
loginToolWindow = CreateToolWindow(Common.Constants.CLASS_NAME_LOGIN, Common.Constants.LOGIN, NewFormattedGuid());
if (loginToolWindow.AutoHides)
{
loginToolWindow.AutoHides = false;
}
loginToolWindow.Visible = true;
loginToolWindow.Width = 460;
loginToolWindow.Height = 210;
Helper.CheckIfLoginWindowIsVisible = true;
}
catch (Exception oEx)
{
LoggingHelper.ShowMessage(oEx);
}
}
示例5: SetButtonImage
public static void SetButtonImage(CommandBarButton button, Bitmap image)
{
button.FaceId = 0;
if (image != null)
{
image.MakeTransparent(Color.Transparent);
Clipboard.SetDataObject(image, true);
button.PasteFace();
}
}
示例6: btnConfSettings_Click
/// <summary>
/// 会议设置响应事件
/// </summary>
/// <param name="Ctrl"></param>
/// <param name="CancelDefault"></param>
public static void btnConfSettings_Click(CommandBarButton Ctrl, ref bool CancelDefault)
{
ThisAddIn.g_log.Info("operator:btnConfSettingsClicked begin");
try
{
VideoConfSettingsForm videoConfSettings = new VideoConfSettingsForm(null);
videoConfSettings.ShowDialog();
}
catch (Exception ex)
{
ThisAddIn.g_log.Error("open VideoConfSettingsForm failed!");
MessageBox.Show(ex.Message);
}
ThisAddIn.g_log.Info("operator:btnConfSettingsClicked end");
}
示例7: btnAbout_Click
/// <summary>
/// 关于响应事件
/// </summary>
/// <param name="Ctrl"></param>
/// <param name="CancelDefault"></param>
public static void btnAbout_Click(CommandBarButton Ctrl, ref bool CancelDefault)
{
ThisAddIn.g_log.Info("operator:btnAboutClicked begin");
try
{
AboutBox aboutBox = new AboutBox();
aboutBox.ShowDialog();
}
catch (Exception ex)
{
ThisAddIn.g_log.Error(string.Format("open about failed, because {0}", ex.Message));
MessageBox.Show(ex.Message);
}
ThisAddIn.g_log.Info("operator:btnAboutClicked end");
}
示例8: TreeBar
public TreeBar(FDMenus menus, ProjectContextMenu treeMenu)
{
this.menus = menus;
this.treeMenu = treeMenu;
Refresh = new CommandBarButton("Refresh");
Refresh.Image = Icons.Refresh.Img;
EnableTrace = new CommandBarCheckBox(Icons.Debug.Img,"Enable Trace");
Items.Add(treeMenu.ShowHidden);
Items.Add(Refresh);
Items.Add(new CommandBarSeparator());
Items.Add(menus.ProjectMenu.Properties);
Items.Add(new CommandBarSeparator());
Items.Add(EnableTrace);
}
示例9: VSMenuCommand
public VSMenuCommand(VSMenu menu, string name, string displayName, string description)
{
this._menu = menu;
this._name = name;
this._displayName = displayName;
this._description = description;
object[] array = new object[0];
Commands2 commands = (Commands2)menu.VSAddin.ApplicationObject.Commands;
try
{
this._command = commands.AddNamedCommand2(menu.VSAddin.AddInInstance, name, displayName, description, true, 0, ref array, 3, 3, vsCommandControlType.vsCommandControlTypeButton);
}
catch
{
this._command = commands.Item(menu.VSAddin.AddInInstance.ProgID + "." + name, 0);
}
this._button = (CommandBarButton)this._command.AddControl(this._menu.Popup.CommandBar, 1);
}
示例10: OnProcessText
public void OnProcessText(CommandBarButton ctrl, ref bool canceldefault)
{
var span = new Stopwatch();
span.Start();
_application.ScreenUpdating = false;
var state = _application.ActiveWindow.View.ShowHiddenText;
_application.ActiveWindow.View.ShowHiddenText = true;
var changes = RemoveHidden() + RemoveFragments("{}");
_application.ActiveWindow.View.ShowHiddenText = state;
_application.ScreenUpdating = true;
ClearSelection();
span.Stop();
var secs = span.ElapsedMilliseconds / 1000d;
const string Msg = "Deleted {0} fragments\r\nTime spent: {1} sec";
MessageBox.Show(string.Format(Msg, changes, secs), "Fragments operations");
}
示例11: btnHelp_Click
/// <summary>
/// 帮助响应事件
/// </summary>
/// <param name="Ctrl"></param>
/// <param name="CancelDefault"></param>
public static void btnHelp_Click(CommandBarButton Ctrl, ref bool CancelDefault)
{
ThisAddIn.g_log.Info("operator:btnHelpClicked begin");
try
{
if (File.Exists(ThisAddIn.helpFilePath))
{
System.Diagnostics.Process.Start(ThisAddIn.helpFilePath);
}
else
{
ThisAddIn.g_log.Error(string.Format("Help .chm can not find."));
//MessageBox.Show("Help .chm can not find.");
}
}
catch (Exception ex)
{
ThisAddIn.g_log.Error(string.Format("Help .chm can not find, cause {0}", ex.Message));
MessageBox.Show(ex.Message);
}
ThisAddIn.g_log.Info("operator:btnHelpClicked end");
}
示例12: AddMenuBar
private void AddMenuBar()
{
try
{
Office.CommandBar menubar = (Office.CommandBar)Application.CommandBars.ActiveMenuBar;
// Add the menu.
menuCommand = (Office.CommandBarButton)menubar.Controls.Add(
Office.MsoControlType.msoControlButton, missing, missing, missing, true);
menuCommand.Style = MsoButtonStyle.msoButtonIconAndWrapCaptionBelow;
menuCommand.Caption = Resources.ItemMenu;
menuCommand.Tag = "200";
menuCommand.FaceId = 65;
menuCommand.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(
menuCommand_Click);
this.Enabled = false;
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
示例13: ProjectContextMenu
public ProjectContextMenu(FDMenus menus)
{
this.menus = menus;
AddNewClass = CreateButton("New &Class..",Icons.ActionScript.Img);
AddNewXml = CreateButton("New &Xml File..",Icons.XmlFile.Img);
AddNewFile = CreateButton("New &File..",Icons.AddFile.Img);
AddNewFolder = CreateButton("New F&older",Icons.Folder.Img);
AddLibraryAsset = CreateButton("Library &Asset..",Icons.ImageResource.Img);
AddExistingFile = CreateButton("&Existing File..",Icons.HiddenFile.Img);
Open = CreateButton("&Open",Icons.OpenFile.Img);
Insert = CreateButton("&Insert Into Document",Icons.EditFile.Img);
Execute = CreateButton("&Execute");
Cut = CreateButton("Cu&t",Icons.Cut.Img);
Copy = CreateButton("Cop&y");
Paste = CreateButton("&Paste",Icons.Paste.Img);
Delete = CreateButton("&Delete",Icons.Delete.Img);
Rename = CreateButton("Rena&me");
AlwaysCompile = new CommandBarCheckBox("Always &Compile");
AddLibrary = new CommandBarCheckBox("Add to &Library");
LibraryOptions = CreateButton("&Options...",Icons.Options.Img);
Hide = new CommandBarCheckBox("&Hide File");
ShowHidden = new CommandBarCheckBox(Icons.HiddenFile.Img,"&Show Hidden Items");
NothingToDo = new CommandBarButton("Not a valid group");
NothingToDo.IsEnabled = false;
NoProjectOutput = new CommandBarButton("(Project output not built)");
NoProjectOutput.IsEnabled = false;
AddMenu = new CommandBarMenu("&Add");
AddMenu.Items.Add(AddNewClass);
AddMenu.Items.Add(AddNewXml);
AddMenu.Items.Add(AddNewFile);
AddMenu.Items.Add(AddNewFolder);
AddMenu.Items.AddSeparator();
AddMenu.Items.Add(AddLibraryAsset);
AddMenu.Items.Add(AddExistingFile);
}
示例14: CreateCommandBar
/// <summary>
/// Creates a command-bar.
/// </summary>
public void CreateCommandBar()
{
string commandBarName = Resources.GetString(ResourceTokens.CommandBarName);
Object missing = System.Reflection.Missing.Value;
CommandBar commandBar = VisioUtils.GetCommandBar(Application, commandBarName);
if (commandBar != null)
return;
//adicionar a barra ao Visio
CommandBars applicationCommandBars = (CommandBars)Application.CommandBars;
commandBar = applicationCommandBars.Add(commandBarName, MsoBarPosition.msoBarTop, false, true);
// Validate transition Button
_validateButton = (CommandBarButton)commandBar.Controls.Add(MsoControlType.msoControlButton, missing, missing, 1, false);
_validateButton.Click += new _CommandBarButtonEvents_ClickEventHandler(this.validateTransition_Click);
SetButtonProperties(_validateButton, ResourceTokens.ButtonValidate, ResourceTokens.ButtonValidateTooltip, TagValidateButton, "Validate.bmp", "Validate-Mask.bmp");
// Export transition
_exportXMLButton = (CommandBarButton)commandBar.Controls.Add(MsoControlType.msoControlButton, missing, missing, 2, false);
_exportXMLButton.Click += new _CommandBarButtonEvents_ClickEventHandler(this.exportTransition_Click);
SetButtonProperties(_exportXMLButton, ResourceTokens.ButtonExport, ResourceTokens.ButtonExportTooltip, TagExportXMLButton, "Export.bmp", "Export-Mask.bmp");
// User cannot customize our commandbar
commandBar.Protection = MsoBarProtection.msoBarNoCustomize;
// Toolbar is only visible when viewing the drawing
commandBar.Context = Convert.ToString((short)VisUIObjSets.visUIObjSetDrawing, CultureInfo.InvariantCulture) + "*";
_application.DocumentCreated += new EApplication_DocumentCreatedEventHandler(_application_DocumentCreated);
_application.DocumentOpened += new EApplication_DocumentOpenedEventHandler(_application_DocumentOpened);
_application.BeforeDocumentClose += new EApplication_BeforeDocumentCloseEventHandler(_application_BeforeDocumentClose);
_application.WindowActivated += new EApplication_WindowActivatedEventHandler(_application_WindowActivated);
_application.ViewChanged += new EApplication_ViewChangedEventHandler(_application_ViewChanged);
}
示例15: Settings_Click
private void Settings_Click(CommandBarButton cmdBarbutton, ref bool cancel)
{
Settings DialogSettings = new Settings(app);
DialogSettings.ShowDialog();
onDocumentLoad();
}