/// <summary> /// Raised when 'Select All' or 'Select None' is displayed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void toggleAll_Click(object sender, EventArgs e) { foreach (ToolStripItem item in this.Items) { ToolStripButton button = item as ToolStripButton; if (button != null) { if ((bool)toggleAll.Tag) { if (!button.Checked) { button.PerformClick(); } } else { if (button.Checked) { button.PerformClick(); } } } } UpdateToggleAll(); }
public void Run() { if ((int)btRefreshStop.Tag == 0) { btRefreshStop.PerformClick(); } }
private void ObjectiveViewer_FormClosing(object sender, FormClosingEventArgs e) { if (_subWindow != null) { _subWindow.Dispose(); } while (!save.Enabled) { ; } save.PerformClick(); }
public HealthMonitoringDialog() { InitializeComponent(); BindToolStripMenu(); bsList.CurrentChanged += (s, e) => SetSelectedItem(); bsList.DataSourceChanged += (s, e) => { SetButtonEnabledState(); SetSelectedItem(); }; dgList.DoubleClick += (s, e) => btnSetBedParameters.PerformClick(); dgList.CellPainting += dgList_CellPainting; dgList.DataSource = bsList; LoadBeds(); LoadSafeValues(); SetButtonEnabledState(); }
/// <summary> /// Sets tool to annotation mover. /// </summary> public void ResetAnnotation() { if (!buttonStickyAnnotationTools.Checked) { buttonCross.PerformClick(); } }
public void ToolStripItemGroup_Add_ToolStripButton() { var statusLabel = new ToolStripStatusLabel(); var tsiGroupManager = new ToolStripItemGroupManager(statusLabel); var item = new ToolStripButton() { CheckOnClick = true, Checked = true }; sut = tsiGroupManager.Create <TestToolStripItemGroup>(new[] { item }, ToolStripItemGroupImage); sut.Add(item); Assert.IsFalse(item.CheckOnClick); Assert.IsFalse(item.Checked); Assert.IsFalse(sut.Checked); item.Checked = true; Assert.IsTrue(sut.Checked); var mouseClick2Called = false; sut.MyMouseClick += (s, e) => { mouseClick2Called = true; }; item.PerformClick(); Assert.IsTrue(mouseClick2Called); Assert.AreEqual(sut.Image, item.Image); Assert.AreEqual(sut.Text, item.Text); Assert.AreEqual(sut.ToolTipText, item.ToolTipText); }
void DisplayBook(HSSFWorkbook book) { ToolStripButton firstBtn = null; int cx = book.NumberOfSheets; for (int x = 0; x < cx; x++) { int si = x; ToolStripButton tsb = new ToolStripButton(book.GetSheetName(x)); tsb.Click += delegate(object sender, EventArgs e) { for (int t = 1; t < tss.Items.Count; t++) { ((ToolStripButton)tss.Items[t]).Checked = (tss.Items[t] == tsb); } ActivateSheet((NPOI.SS.UserModel.Sheet)book.GetSheetAt(si)); }; tss.Items.Add(tsb); firstBtn = firstBtn ?? tsb; } if (firstBtn != null) { firstBtn.PerformClick(); } CloseWIP(); }
public static void CheckComputerRole( ref ToolStripButton toolStripButtonExit ) { if (!( Properties.Settings.Default.UsuarioNombre.ToLower() == "admin" || Roles.IsUserInRole(Properties.Settings.Default.UsuarioNombre, "admin") || Properties.Settings.Default.SettingComputerRole == 0 //full role )) { switch (Properties.Settings.Default.SettingComputerRole) { //case 0: //full role // break; //case 1: //Returns/Sales // break; //case 2: //Cashier // break; case 3: //Shipping break; default: //anything else toolStripButtonExit.PerformClick(); break; } } }
void editControl_MouseUp(object sender, MouseEventArgs e) { RecheckUndoRedo(); if (latestSelected != null) { latestSelected.PerformClick(); latestSelected = null; } }
public static ToolStripButton click(this ToolStripButton button) { return(button.toolStrip().invokeOnThread( () => { button.PerformClick(); return button; })); }
private void PhysicsPainter_KeyUp(object sender, KeyEventArgs e) { if (_isAltDown && !e.Alt) { // Once they let off the ban, go back to before _isAltDown = false; _beforePanButton.PerformClick(); } }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { ToolStripItem[] Ctrl = bindingNavigator1.Items.Find(ClsButtonEvents._IClsButtonEvents.ButtonName(keyData), true); if (Ctrl != null && Ctrl.Length > 0) { ToolStripButton toolStripButton = (ToolStripButton)Ctrl[0]; toolStripButton.PerformClick(); } return(base.ProcessCmdKey(ref msg, keyData)); }
/// <summary> /// チェック状態を設定します。 /// </summary> /// <param name="checkButton">チェックボックス。</param> /// <param name="value">チェック状態。</param> static void EmulateCheckInTarget(ToolStripButton checkButton, CheckState value) { if (checkButton.Owner == null) { throw new NotSupportedException(ResourcesLocal.Instance.ErrorNotSetToolStrip); } checkButton.Owner.Focus(); while (checkButton.CheckState != value) { checkButton.PerformClick(); } }
public void Constructor() { ToolStripButton tsi = new ToolStripButton(); Assert.AreEqual(true, tsi.AutoToolTip, "A1"); Assert.AreEqual(true, tsi.CanSelect, "A2"); Assert.AreEqual(false, tsi.Checked, "A3"); Assert.AreEqual(false, tsi.CheckOnClick, "A4"); Assert.AreEqual(CheckState.Unchecked, tsi.CheckState, "A5"); int count = 0; EventHandler oc = new EventHandler(delegate(object sender, EventArgs e) { count++; }); Image i = new Bitmap(1, 1); tsi = new ToolStripButton(i); tsi.PerformClick(); Assert.AreEqual(null, tsi.Text, "A6"); Assert.AreSame(i, tsi.Image, "A7"); Assert.AreEqual(0, count, "A8"); Assert.AreEqual(string.Empty, tsi.Name, "A9"); tsi = new ToolStripButton("Text"); tsi.PerformClick(); Assert.AreEqual("Text", tsi.Text, "A10"); Assert.AreSame(null, tsi.Image, "A11"); Assert.AreEqual(0, count, "A12"); Assert.AreEqual(string.Empty, tsi.Name, "A13"); tsi = new ToolStripButton("Text", i); tsi.PerformClick(); Assert.AreEqual("Text", tsi.Text, "A14"); Assert.AreSame(i, tsi.Image, "A15"); Assert.AreEqual(0, count, "A16"); Assert.AreEqual(string.Empty, tsi.Name, "A17"); tsi = new ToolStripButton("Text", i, oc); tsi.PerformClick(); Assert.AreEqual("Text", tsi.Text, "A18"); Assert.AreSame(i, tsi.Image, "A19"); Assert.AreEqual(1, count, "A20"); Assert.AreEqual(string.Empty, tsi.Name, "A21"); tsi = new ToolStripButton("Text", i, oc, "Name"); tsi.PerformClick(); Assert.AreEqual("Text", tsi.Text, "A22"); Assert.AreSame(i, tsi.Image, "A23"); Assert.AreEqual(2, count, "A24"); Assert.AreEqual("Name", tsi.Name, "A25"); }
void ListCancelButtonClick(object?sender, EventArgs e) { if (SelectedOrder is not Fix.Order order) { return; } if (order.ListID == null) { MessageBox.Show(this, "The selected order does not have a ListID so a ListCancel cannot be performed", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } _defaultsButton.PerformClick(); _messageDefaults.ListCancel(order.ListID); }
public PainterForm(Model model) //建構元 { const int HEIGHT = 480; const int WIDTH = 640; this.Size = new Size(WIDTH, HEIGHT); this._model = model; AddToolStrip(); AddAllMenuItem(); AddAction(); this.Icon = ((System.Drawing.Icon)(_resources.GetObject("$this.Icon"))); this.Text = "Basic Painter"; this.DoubleBuffered = true; _pointerToolStripButton.PerformClick(); }
private void InitToolBar() { _tb.GripStyle = ToolStripGripStyle.Hidden; _tb.ImageScalingSize = new Size(48, 48); var tsbSettings = new ToolStripButton(string.Empty, (Bitmap)Resources.ResourceManager.GetObject("tb_settings_png"), (sender, args) => SwapControl(_container, _generalSettingsPage)) { Alignment = ToolStripItemAlignment.Right, Tag = "Configure Tiler" }; var tsbAppPlacements = new ToolStripButton(string.Empty, (Bitmap)Resources.ResourceManager.GetObject("tb_app_placements_png"), (sender, args) => SwapControl(_container, _applicationConfigPage)) { Alignment = ToolStripItemAlignment.Right, Tag = "Configure Applications" }; var tsbPlacements = new ToolStripButton(string.Empty, (Bitmap)Resources.ResourceManager.GetObject("tb_placements_png"), (sender, args) => SwapControl(_container, _placementConfigPage)) { Alignment = ToolStripItemAlignment.Right, Tag = "Configure Regions" }; var tsLblCaption = new ToolStripLabel { Alignment = ToolStripItemAlignment.Left, Font = new Font(SystemFonts.CaptionFont.Name, 18, FontStyle.Bold) }; var allButtons = new[] { tsbPlacements, tsbSettings, tsbAppPlacements }; foreach (var button in allButtons) { button.Click += (sender, args) => ToggleGroupButtons(allButtons, button); button.Click += (sender, args) => tsLblCaption.Text = button.Tag.ToString(); } _tb.Items.Add(tsLblCaption); _tb.Items.Add(tsbSettings); _tb.Items.Add(new ToolStripSeparator { Alignment = ToolStripItemAlignment.Right }); _tb.Items.Add(tsbPlacements); _tb.Items.Add(new ToolStripSeparator { Alignment = ToolStripItemAlignment.Right }); _tb.Items.Add(tsbAppPlacements); tsbAppPlacements.PerformClick(); }
private void CheckNextToolStripItem(ArrowDirection direction) { ToolStripButton button = toolStrip1 .Items .Cast <ToolStripButton>() .FirstOrDefault(t => t.Checked); if (button != null) { ToolStripButton nextButton = (ToolStripButton)toolStrip1.GetNextItem(button, direction); if (nextButton != null) { nextButton.PerformClick(); } } }
void KeysDownEve(string key) { string[] str = key.Split(':'); for (int i = 0; i < str.Length; i++) { string s = str[i]; bool bl = false; foreach (var item in toolstripmain1.Items) { if (item is ToolStripButton) { ToolStripButton t = (ToolStripButton)item; if (t.Text == s) { t.PerformClick(); bl = true; } } } if (!bl) { foreach (var item in toolstripmain2.Items) { if (item is ToolStripButton) { ToolStripButton t = (ToolStripButton)item; if (t.Text == s) { t.PerformClick(); bl = true; } } } } } }
private void UnifiedDesignerForm_Load(object sender, EventArgs e) { reportDesigner.LoadReport(new FileInfo("CustomTileProvider.rdlx")); _helpButton.PerformClick(); }
private void tongji_MainInfo_Load(object sender, EventArgs e) { try { sysmenuBll menubll = new sysmenuBll(); IList <SYS_MENUS> list = menubll.GetList("统计报表"); foreach (SYS_MENUS obj in list) { if (obj.MENU_LEVER == "1") { if (String.IsNullOrEmpty(obj.MENU_URL)) { ToolStripDropDownButton tsdb = new ToolStripDropDownButton(); if (File.Exists(@Application.StartupPath + "\\" + obj.MENU_IMAGE)) { tsdb.Image = Image.FromFile(Application.StartupPath + "\\" + obj.MENU_IMAGE); } tsdb.Name = obj.MENU_CODE; tsdb.Size = new System.Drawing.Size(85, 29); tsdb.Text = obj.MENU_NAME; tsdb.Tag = obj; toolStrip2.Items.Add(tsdb); } else { ToolStripButton tsdb = new ToolStripButton(); if (File.Exists(@Application.StartupPath + "\\" + obj.MENU_IMAGE)) { tsdb.Image = Image.FromFile(Application.StartupPath + "\\" + obj.MENU_IMAGE); } tsdb.Name = obj.MENU_CODE; tsdb.Size = new System.Drawing.Size(85, 29); tsdb.Text = obj.MENU_NAME; tsdb.Tag = obj; if (obj.IS_CUSTOM == "2")//如果不是自定义的页面,调用已有的页面 { tsdb.Click += new System.EventHandler(this.tsdb_Click); } else//否则调用文书生成界面 { tsdb.Click += new System.EventHandler(this.tsdb_temp_Click); } toolStrip2.Items.Add(tsdb); if (obj.IS_DEFAULT == "1") { tsdb.PerformClick(); } } } else if (obj.MENU_LEVER == "2") { ToolStripMenuItem tsm = new ToolStripMenuItem(); if (File.Exists(@Application.StartupPath + "\\" + obj.MENU_IMAGE)) { tsm.Image = Image.FromFile(Application.StartupPath + "\\" + obj.MENU_IMAGE); } tsm.Name = obj.MENU_CODE; tsm.Size = new System.Drawing.Size(220, 22); tsm.Text = obj.MENU_NAME; tsm.Tag = obj; if (obj.IS_CUSTOM == "2")//如果不是自定义的页面,调用已有的页面 { tsm.Click += new System.EventHandler(this.tsm_Click); } else//否则调用文书生成界面 { tsm.Click += new System.EventHandler(this.tsm_temp_Click); } foreach (ToolStripItem tsdb in toolStrip2.Items) { if (tsdb.Name == obj.MENU_PARENT) { (tsdb as ToolStripDropDownButton).DropDownItems.Add(tsm); break; } } if (obj.IS_DEFAULT == "1") { tsm.PerformClick(); } } } } catch (Exception ex) { MessageBox.Show("系统异常,请联系管理员!"); throw ex; } finally { Cursor.Current = Cursors.Default; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); reportDesigner.LoadReport(new FileInfo(_reportName)); _helpButton.PerformClick(); }
private void sameClieckEvent(ToolStripMenuItem menuItem, ToolStripButton stripButton) { menuItem.Text = stripButton.Text; menuItem.Click += (sender, e) => { stripButton.PerformClick(); }; }
//主窗体加载时自动打开基本信息的一般信息窗口 private void refreshInfo() { Cursor.Current = Cursors.WaitCursor; bindDataNowday();//绑定左边列表数据 try { //得到测评工作站下权限集合 sysmenuBll menubll = new sysmenuBll(); IList <SYS_MENUS> list = menubll.GetListBySql("测评室工作站", globalInfoClass.User_Role); foreach (SYS_MENUS obj in list) { if (obj.MENU_LEVER == "1") { if (String.IsNullOrEmpty(obj.MENU_URL)) { ToolStripDropDownButton tsdb = new ToolStripDropDownButton(); if (File.Exists(@Application.StartupPath + "\\" + obj.MENU_IMAGE)) { tsdb.Image = Image.FromFile(Application.StartupPath + "\\" + obj.MENU_IMAGE); } tsdb.Name = obj.MENU_CODE; tsdb.Size = new System.Drawing.Size(85, 29); tsdb.Text = obj.MENU_NAME; tsdb.Tag = obj; toolStrip2.Items.Add(tsdb); } else { ToolStripButton tsdb = new ToolStripButton(); if (File.Exists(@Application.StartupPath + "\\" + obj.MENU_IMAGE)) { tsdb.Image = Image.FromFile(Application.StartupPath + "\\" + obj.MENU_IMAGE); } tsdb.Name = obj.MENU_CODE; tsdb.Size = new System.Drawing.Size(85, 29); tsdb.Text = obj.MENU_NAME; tsdb.Tag = obj; if (obj.IS_CUSTOM == "2")//如果不是自定义的页面,调用已有的页面 { tsdb.Click += new System.EventHandler(this.tsdb_Click); } else//否则调用文书生成界面 { tsdb.Click += new System.EventHandler(this.tsdb_temp_Click); } toolStrip2.Items.Add(tsdb); if (obj.IS_DEFAULT == "1") { tsdb.PerformClick(); } } } else if (obj.MENU_LEVER == "2") { ToolStripMenuItem tsm = new ToolStripMenuItem(); if (File.Exists(@Application.StartupPath + "\\" + obj.MENU_IMAGE)) { tsm.Image = Image.FromFile(Application.StartupPath + "\\" + obj.MENU_IMAGE); } tsm.Name = obj.MENU_CODE; tsm.Size = new System.Drawing.Size(220, 22); tsm.Text = obj.MENU_NAME; tsm.Tag = obj; if (obj.IS_CUSTOM == "2")//如果不是自定义的页面,调用已有的页面 { tsm.Click += new System.EventHandler(this.tsm_Click); } else//否则调用文书生成界面 { tsm.Click += new System.EventHandler(this.tsm_temp_Click); } foreach (ToolStripItem tsdb in toolStrip2.Items) { if (tsdb.Name == obj.MENU_PARENT) { (tsdb as ToolStripDropDownButton).DropDownItems.Add(tsm); break; } } if (obj.IS_DEFAULT == "1") { tsm.PerformClick(); } } } } catch (Exception ex) { MessageBox.Show("系统异常,请联系管理员!"); throw ex; } finally { dataGridView1_CellEnter(null, null); Cursor.Current = Cursors.Default; } }
void _tsmiExit_Click(object sender, EventArgs e) { ToolStripButton tsbExit = getObject(43, "tsbExit") as ToolStripButton; tsbExit.PerformClick(); }
public static void LoadFormShortcutKey(Form form, string strShortcutKeys, ref bool handled) { if (strShortcutKeys.Contains("Control") || strShortcutKeys.Contains("F")) { try { if (form.Controls.Count <= 0) { return; } foreach (Control items in form.Controls) { if (items.Tag != null && items is Button) { Button button = (Button)items; if (button.Tag.ToString().Equals(strShortcutKeys)) { button.PerformClick(); handled = true; return; } } object parentControl = items; if (parentControl is MenuStrip) { MenuStrip menu = (MenuStrip)parentControl; foreach (ToolStripItem item in menu.Items) { if (item.Tag != null && item is ToolStripButton) { ToolStripButton button = (ToolStripButton)item; if (button.Tag.ToString().Equals(strShortcutKeys)) { button.PerformClick(); handled = true; return; } } CheckControls(item, strShortcutKeys); } return; } if (parentControl is ToolStrip) { ToolStrip menu = (ToolStrip)parentControl; foreach (ToolStripItem item in menu.Items) { if (item.Tag != null) { ToolStripItem button = (ToolStripItem)item; if (button.Tag.ToString().Equals(strShortcutKeys)) { button.PerformClick(); handled = true; return; } } CheckControls(item, strShortcutKeys); } } if (parentControl is ToolStripMenuItem) { ToolStripItemCollection menuitems = ((ToolStripMenuItem)parentControl).DropDownItems; foreach (ToolStripItem item in menuitems) { if (item.Tag != null) { ToolStripItem button = (ToolStripItem)item; if (button.Tag.ToString().Equals(strShortcutKeys)) { button.PerformClick(); handled = true; return; } } CheckControls(item, strShortcutKeys); } } //CheckControls(item, strShortcutKeys); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { if (strShortcutKeys == "Escape") { form.Close(); } } }
public static void CheckControls(object parentControl, string strShortcutKeys) { try { if (parentControl is MenuStrip) { MenuStrip menu = (MenuStrip)parentControl; foreach (ToolStripItem item in menu.Items) { if (item.Tag != null && item is ToolStripButton) { ToolStripButton button = (ToolStripButton)item; if (button.Tag.ToString().Equals(strShortcutKeys)) { button.PerformClick(); return; } } CheckControls(item, strShortcutKeys); } return; } if (parentControl is ToolStripMenuItem) { ToolStripItemCollection menuitems = ((ToolStripMenuItem)parentControl).DropDownItems; foreach (ToolStripItem item in menuitems) { if (item.Tag != null) { ToolStripItem button = (ToolStripItem)item; if (button.Tag.ToString().Equals(strShortcutKeys)) { button.PerformClick(); return; } } CheckControls(item, strShortcutKeys); } return; } if (parentControl is ToolStripSplitButton) { ToolStripSplitButton menu = (ToolStripSplitButton)parentControl; foreach (ToolStripItem item in menu.DropDown.Items) { if (item.Tag != null) { ToolStripItem button = (ToolStripItem)item; if (button.Tag.ToString().Equals(strShortcutKeys)) { button.PerformClick(); return; } } CheckControls(item, strShortcutKeys); } return; } if (parentControl is ToolStrip) { ToolStrip menu = (ToolStrip)parentControl; foreach (ToolStripItem item in menu.Items) { if (item.Tag != null) { ToolStripItem button = (ToolStripItem)item; if (button.Tag.ToString().Equals(strShortcutKeys)) { button.PerformClick(); return; } } CheckControls(item, strShortcutKeys); } return; } if (parentControl is Panel) { foreach (Control item in (parentControl as Control).Controls) { if (item is Button) { Button button = (Button)item; if (button.Tag.ToString().Equals(strShortcutKeys)) { button.PerformClick(); return; } } } return; } //if (parentControl is DevExpress.XtraNavBar.NavBarControl) //{ // DevExpress.XtraNavBar.NavBarControl _navBarControl = (DevExpress.XtraNavBar.NavBarControl)parentControl; // foreach (DevExpress.XtraNavBar.NavBarGroup _navBarGroup in _navBarControl.Groups) // { // foreach (DevExpress.XtraNavBar.NavBarItemLink item in _navBarGroup.ItemLinks) // { // if (item.Item.Tag != null && !item.Item.Tag.ToString().Equals("")) // { // bool isExitsPermission = CheckExistsValue(item.Item.Tag.ToString(),strShortcutKeys); // DevExpress.XtraNavBar.NavBarItemLink button = (DevExpress.XtraNavBar.NavBarItemLink)item.Item; // button. // if (!isExitsPermission) // item.Item.Appearance.ForeColor = Color.DarkGray; // } // } // } // return; //} } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void _init_Printer(object sender, EventArgs e) { printDocument1.Print(); closeButton.PerformClick(); }
public void PerformClick() { btn.PerformClick(); }
void KeysDownEve(string key) { string[] str = key.Split(':'); for (int i = 0; i < str.Length; i++) { string k = str[i]; bool bl = false; switch (k) { case "双面选择": if (chkDoublePages.Checked == false) { chkDoublePages.Checked = true; } else { chkDoublePages.Checked = false; } bl = true; break; case "纵向": rdVerPages.Checked = true; bl = true; break; case "横向": rdHorpages.Checked = true; bl = true; break; case "A3": comPagesSize.SelectedIndex = 2; bl = true; break; case "A4": comPagesSize.SelectedIndex = 1; bl = true; break; case "B5": comPagesSize.SelectedIndex = 0; bl = true; break; case "彩色": rdColorRed.Checked = true; bl = true; break; case "灰度": rdColorGray.Checked = true; bl = true; break; case "黑白": rdColorWithe.Checked = true; bl = true; break; case "ADF": rdFeedAuto.Checked = true; bl = true; break; case "平板": rdFeedFlat.Checked = true; bl = true; break; } if (bl) { return; } foreach (var item in toolStrip1.Items) { if (item is ToolStripButton) { ToolStripButton t = (ToolStripButton)item; if (t.Text == k) { t.PerformClick(); } } } } }