Inheritance: System.ComponentModel.Component, IDropTarget, IComponent, IDisposable
 protected void ApplyLanguage(ToolStripItem applyTo, string languageKey)
 {
     if (!string.IsNullOrEmpty(languageKey))
     {
         if (!Language.hasKey(languageKey))
         {
             LOG.WarnFormat("Wrong language key '{0}' configured for control '{1}'", languageKey, applyTo.Name);
             if (DesignMode)
             {
                 MessageBox.Show(string.Format("Wrong language key '{0}' configured for control '{1}'", languageKey, applyTo.Name));
             }
             return;
         }
         applyTo.Text = Language.GetString(languageKey);
     }
     else
     {
         // Fallback to control name!
         if (Language.hasKey(applyTo.Name))
         {
             applyTo.Text = Language.GetString(applyTo.Name);
             return;
         }
         if (this.DesignMode)
         {
             MessageBox.Show(string.Format("Greenshot control without language key: {0}", applyTo.Name));
         }
         else
         {
             LOG.DebugFormat("Greenshot control without language key: {0}", applyTo.Name);
         }
     }
 }
Example #2
0
        public EditorToolStrip()
        {
            var dropDown = new ToolStripDropDownButton();
            dropDown.Text = "Style";
            dropDown.Alignment = ToolStripItemAlignment.Right;
            dropDown.DropDownItems.Add("Default");
            dropDown.DropDownItems.Add("GitHub");

            var items = new ToolStripItem[] {
                dropDown,
                new ToolStripMenuItem("Some Button")
            };

            this._dataSourceMock = new Mock<IEditorToolStripDataSource>();
            this._dataSourceMock.Setup(m => m.NumberOfEditorToolStripItems(It.IsAny<Model.EditorToolStrip>()))
                .Returns(items.Length)
                .Verifiable();

            this._dataSourceMock.Setup(m => m.EditorToolStripItemForIndex(It.IsAny<Model.EditorToolStrip>(), It.IsAny<int>()))
                .Returns<Model.EditorToolStrip, int>((inst, index) =>
                {
                    return items[index];
                })
                .Verifiable();

            this._subject = new Model.EditorToolStrip(this._dataSourceMock.Object, null);
        }
Example #3
0
 public void Add(ToolStripItem[] toolStripItems,
     MenuItem[] menuItems,
     EventHandler clickDelegate,
     ValidateCommand validateDelegate)
 {
     _commands.Add(new Command(toolStripItems, menuItems, clickDelegate, validateDelegate));
 }
        /// <summary>
        /// Constructor for the Print Preview dialog
        /// </summary>        
        public EnterPrintPreviewDialog()
        {
            Type t = typeof(PrintPreviewDialog);
            FieldInfo fieldInfo = t.GetField("toolStrip1", BindingFlags.Instance | BindingFlags.NonPublic);
            FieldInfo fieldInfo2 = t.GetField("printToolStripButton", BindingFlags.Instance | BindingFlags.NonPublic);

            ToolStrip toolStrip1 = (ToolStrip)fieldInfo.GetValue(this);
            ToolStripButton printButton = (ToolStripButton)fieldInfo2.GetValue(this);

            printButton.Visible = false;

            enterPrintButton = new ToolStripButton();
            enterPrintButton.ToolTipText = printButton.ToolTipText;
            enterPrintButton.ImageIndex = 0;

            ToolStripItem[] oldButtons = new ToolStripItem[toolStrip1.Items.Count];

            for (int i = 0; i < oldButtons.Length; i++)
            {
                oldButtons[i] = toolStrip1.Items[i];
            }

            toolStrip1.Items.Clear();
            toolStrip1.Items.Add(enterPrintButton);

            for (int i = 0; i < oldButtons.Length; i++)
            {
                toolStrip1.Items.Add(oldButtons[i]);
            }

            toolStrip1.ItemClicked += new ToolStripItemClickedEventHandler(toolStrip1_ItemClicked);
        }
        public void CombineMenusWithoutAdapterMenuItem()
        {
            ContextMenuStrip contextMenuStripFirst = new ContextMenuStrip();
            contextMenuStripFirst.Items.Add("item1");
            contextMenuStripFirst.Items.Add("item2");
            contextMenuStripFirst.Items.Add("item3");

            ContextMenuStrip contextMenuStripSecond = new ContextMenuStrip();
            contextMenuStripSecond.Items.Add("item4");
            contextMenuStripSecond.Items.Add("item5");

            Assert.AreEqual(3, contextMenuStripFirst.Items.Count);
            Assert.AreEqual(2, contextMenuStripSecond.Items.Count);

            // AddRange doesn't work!
            // contextMenuStripFirst.Items.AddRange(contextMenuStripSecond.Items);

            ToolStripItem[] toolStripItems = new ToolStripItem[contextMenuStripSecond.Items.Count];
            contextMenuStripSecond.Items.CopyTo(toolStripItems, 0);
            contextMenuStripFirst.Items.AddRange(toolStripItems);

            Assert.AreEqual(5, contextMenuStripFirst.Items.Count);

            // NB 0 is not what I want; a menuitem can only be part of 1 menu
            Assert.AreEqual(0, contextMenuStripSecond.Items.Count);
        }
 public static void ChangeImage(ToolStripItem item, Image itemImage)
 {
     MethodInvoker method = null;
     if (item.Image != itemImage)
     {
         if ((item.Owner != null) && item.Owner.InvokeRequired)
         {
             if (method == null)
             {
                 method = delegate {
                     lock (itemImage)
                     {
                         item.Image = itemImage;
                     }
                 };
             }
             item.Owner.BeginInvoke(method);
         }
         else
         {
             lock (itemImage)
             {
                 item.Image = itemImage;
             }
         }
     }
 }
 public MapControlAction(MapControl control, DisplayToolId id, ToolStripItem[] items)
 {
     m_Control = control;
     m_ToolId = id;
     m_Elements = new UserActionSupport(items);
     m_Elements.SetHandler(Do);
 }
 /// <summary>
 /// The add item.
 /// </summary>
 /// <param name="item">
 /// The item.
 /// </param>
 public void AddItem(ToolStripItem item)
 {
     if (item != null)
     {
         this._newItems.Add(item);
     }
 }
Example #9
0
        public void Add(string key, ToolStripItem item)
        {
            if (string.IsNullOrEmpty(key))
            {
                key = "_Item" + _Index++;
            }
            _Items[key] = item;

            if (item is ToolStripMenuItem)
            {
                if ((item as ToolStripMenuItem).Checked)
                {
                    _Last = item;
                }
                return;
            }
            if (item is ToolStripButton)
            {
                if ((item as ToolStripButton).Checked)
                {
                    _Last = item;
                }
                return;
            }
        }
Example #10
0
		/// <summary>
		/// Sets the tooltip text on the specified item, from the specified action.
		/// </summary>
		/// <param name="item"></param>
		/// <param name="action"></param>
		internal static void SetTooltipText(ToolStripItem item, IAction action)
		{
			var actionTooltip = action.Tooltip;
			if (string.IsNullOrEmpty(actionTooltip))
				actionTooltip = (action.Label ?? string.Empty).Replace("&", "");

			var clickAction = action as IClickAction;

			if (clickAction == null || clickAction.KeyStroke == XKeys.None)
			{
				item.ToolTipText = actionTooltip;
				return;
			}

			var keyCode = clickAction.KeyStroke & XKeys.KeyCode;

			var builder = new StringBuilder();
			builder.Append(actionTooltip);

			if (keyCode != XKeys.None)
			{
				if (builder.Length > 0)
					builder.AppendLine();
				builder.AppendFormat("{0}: ", SR.LabelKeyboardShortcut);
				builder.Append(XKeysConverter.Format(clickAction.KeyStroke));
			}

			item.ToolTipText = builder.ToString();
		}
Example #11
0
 public PanelTabElement AddTabPanel(Panel panel, ToolStripItem button = null)
 {
     //if (control.GetType() != typeof(Panel))
     //    throw new PBException("only Panel can be add to PanelTabControl");
     PanelTabElement tabElement = new PanelTabElement();
     tabElement.Index = _tabControls.Count;
     tabElement.Panel = panel;
     tabElement.Button = button;
     //if (_tabControls.Count == 0)
     if (_selectedElement == null)
     {
         //_selectedIndex = 0;
         //_selectedControl = control;
         _selectedElement = tabElement;
         panel.Visible = true;
         if (button != null)
             button.BackColor = _buttonSelectedColor;
     }
     else // if (_tabControls.Count > 0)
     {
         panel.Visible = false;
         if (button != null)
             button.BackColor = _buttonUnselectedColor;
     }
     _tabControlsDictionary.Add(panel, _tabControls.Count);
     //_tabControls.Add(control);
     _tabControls.Add(tabElement);
     this.Controls.Add(panel);
     return tabElement;
 }
 public void AddRange(ToolStripItem[] value)
 {
     for (int i = 0; i < value.Length; i++)
     {
         this.Add(value[i]);
     }
 }
 public void SetHelpText(ToolStripItem extendee, string value)
 {
     // A blank value string indicates the control is trying to unregister.
     if (value.Length == 0)
     {
         // Check if the item is registered.
         if (!helpText.ContainsKey(extendee) && !DesignMode)
         {
             // Unregister.
             extendee.MouseEnter -= new EventHandler(MenuSelect);
             extendee.MouseLeave -= new EventHandler(MenuClear);
         }
         helpText.Remove(extendee);
     }
     else
     {
         // The user has supplied help text.
         // Check if the item is registered.
         if (!helpText.ContainsKey(extendee) && !DesignMode)
         {
             // It hasn't been registered yet. Register it now.
             extendee.MouseEnter += new EventHandler(MenuSelect);
             extendee.MouseLeave += new EventHandler(MenuClear);
         }
         // Either way, update the help text.
         helpText[extendee] = value;
     }
 }
Example #14
0
 public void Load(Form parentForm, ToolStripMenuItem editorMenu)
 {
     m_Parent = parentForm;
     m_MenuItem = editorMenu.DropDownItems.Add("Edit map...");
     m_MenuItem.Click += new EventHandler(m_MenuItem_Click);
     m_MenuItem.Tag = this; // Required !
 }
 public ToolStripTemplateNode(IComponent component, string text, Image image)
 {
     this.component = component;
     this.activeItem = component as ToolStripItem;
     this._designerHost = (IDesignerHost) component.Site.GetService(typeof(IDesignerHost));
     this._designer = this._designerHost.GetDesigner(component);
     this._designSurface = (DesignSurface) component.Site.GetService(typeof(DesignSurface));
     if (this._designSurface != null)
     {
         this._designSurface.Flushed += new EventHandler(this.OnLoaderFlushed);
     }
     if (!isScalingInitialized)
     {
         if (System.Windows.Forms.DpiHelper.IsScalingRequired)
         {
             TOOLSTRIP_TEMPLATE_HEIGHT = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsY(0x16);
             TEMPLATE_HEIGHT = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsY(0x13);
             TOOLSTRIP_TEMPLATE_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(0x5c);
             TEMPLATE_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(0x1f);
             TEMPLATE_HOTREGION_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(9);
             MINITOOLSTRIP_DROPDOWN_BUTTON_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(11);
             MINITOOLSTRIP_TEXTBOX_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(90);
         }
         isScalingInitialized = true;
     }
     this.SetupNewEditNode(this, text, image, component);
     this.commands = new MenuCommand[] {
         new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveUp), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveDown), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveLeft), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveRight), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Delete), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Cut), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Copy), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeUp), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeDown), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeLeft), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeRight), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeWidthIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeHeightIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeWidthDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeHeightDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeWidthIncrease),
         new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeHeightIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeWidthDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeHeightDecrease)
      };
     this.addCommands = new MenuCommand[] { new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Undo), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Redo) };
 }
 private void BeginScrollTimer(ToolStripItem item, Point pntClient) {
     int y = pntClient.Y;
     int height = item.Bounds.Height;
     if(CanScroll && ((y < ((height * 0.5) + 11.0)) || ((Height - (height + 11)) < y))) {
         if(timerScroll == null) {
             timerScroll = new Timer();
             timerScroll.Tick += timerScroll_Tick;
         }
         else if(timerScroll.Enabled) {
             return;
         }
         timerScroll.Tag = y < ((height * 0.5) + 11.0);
         iScrollLine = 1;
         if((y < 0x10) || ((Height - 0x10) < y)) {
             timerScroll.Interval = 100;
             if((y < 9) || ((Height - 9) < y)) {
                 iScrollLine = 2;
             }
         }
         else {
             timerScroll.Interval = 250;
         }
         fSuppressMouseMove_Scroll = true;
         timerScroll.Enabled = false;
         timerScroll.Enabled = true;
     }
     else if(timerScroll != null) {
         timerScroll.Enabled = false;
     }
 }
 public ToolStripItemGlyph(ToolStripItem item, ToolStripItemDesigner itemDesigner, Rectangle bounds, System.Windows.Forms.Design.Behavior.Behavior b)
     : base(bounds, Cursors.Default, item, b)
 {
     this._item = item;
     this._bounds = bounds;
     this._itemDesigner = itemDesigner;
 }
Example #18
0
        public override void Add(ToolStripItem item, IViewModel viewModel)
        {
            if (_Items == null)
            {
                _Items = new List<ToolStripItem>();
            }

            _Items.Add(item);
            Pwd.M.ViewModel model = viewModel as Pwd.M.ViewModel;
            if (model == null)
            {
                return;
            }

            bool ok = model.Pattern == CPwd.PATTERN_PRO;
            if (item is ToolStripMenuItem)
            {
                (item as ToolStripMenuItem).Checked = ok;
                return;
            }
            if (item is ToolStripButton)
            {
                (item as ToolStripButton).Checked = ok;
                return;
            }
        }
		/// <summary>
		/// </summary>
		/// <param name="targetItem"></param>
		/// <param name="minWidth"></param>
		/// <exception cref="ArgumentNullException">
		/// <para>
		///		<paramref name="targetItem"/> is <see langword="null"/>.
		/// </para>
		/// </exception>
		public void SetNewWidth(ToolStripItem targetItem, int minWidth)
		{
			if (targetItem == null)
			{
				throw new ArgumentNullException("targetItem");
			}

			if (targetItem.Owner == null)
			{
				return;
			}

			ToolStrip toolStrip = targetItem.Owner;
			int itemsWidth = 0;

			foreach (ToolStripItem item in toolStrip.Items)
			{
				if (
					item != targetItem
					)
				{
					itemsWidth += item.Width + 1;
				}
			}

			targetItem.Width = Math.Max(minWidth, toolStrip.Width - itemsWidth);
			NuGenInvoker invoker = new NuGenInvoker(toolStrip);
			invoker.Methods["OnSizeChanged"].Invoke(EventArgs.Empty);
		}
Example #20
0
		private static void VerifyMenuItemTextAndChecked(ToolStripItem item1, string text, bool fIsChecked)
		{
			var item = item1 as ToolStripMenuItem;
			Assert.IsNotNull(item, "menu item should be ToolStripMenuItem");
			Assert.AreEqual(text, item.Text);
			Assert.AreEqual(fIsChecked, item.Checked, text + " should be in the expected check state");
		}
 private static IEnumerable<ToolStripItem> GetSubItems(ToolStripItem item)
 {
     if (item is ToolStripMenuItem)
     {
         foreach (ToolStripItem tsi in (item as ToolStripMenuItem).DropDownItems)
         {
             if (tsi is ToolStripMenuItem)
             {
                 if ((tsi as ToolStripMenuItem).HasDropDownItems)
                 {
                     foreach (ToolStripItem subItem in GetSubItems((tsi as ToolStripMenuItem)))
                         yield return subItem;
                 }
                 yield return (tsi as ToolStripMenuItem);
             }
             else if (tsi is ToolStripSeparator)
             {
                 yield return (tsi as ToolStripSeparator);
             }
         }
     }
     else if (item is ToolStripSeparator)
     {
         yield return (item as ToolStripSeparator);
     }
 }
Example #22
0
        public override void Add(ToolStripItem item, IViewModel viewModel)
        {
            if (_Items == null)
            {
                _Items = new List<ToolStripItem>();
            }

            _Items.Add(item);
            Pwd.M.ViewModel model = viewModel as Pwd.M.ViewModel;
            if (model == null)
            {
                return;
            }

            if (item is ToolStripMenuItem)
            {
                (item as ToolStripMenuItem).Checked = model.CatTreeVisible;
                return;
            }
            if (item is ToolStripButton)
            {
                (item as ToolStripButton).Checked = model.CatTreeVisible;
                return;
            }
        }
Example #23
0
 public RefactorItem(ToolStripItem item)
 {
     this.item = item;
     label = TextHelper.RemoveMnemonicsAndEllipsis(item.Text);
     description = TextHelper.GetStringWithoutMnemonics("Label.Refactor");
     icon = (Bitmap) (item.Image ?? PluginBase.MainForm.FindImage("452")); //452 or 473
 }
Example #24
0
        public void Unload()
        {
            m_MenuItem.Visible = false;
            m_MenuItem.Dispose();
            m_MenuItem = null;

        }
        public static void SendUserError(string text, string anchor, int displayTime, bool includeBeep, object objin, WorldEditor appin)
        {
            app = appin;
            link = anchor;
            if (includeBeep)
            {
                SystemSounds.Beep.Play();
            }
            obj = objin;

            if (showing == false)
            {
                showing = true;
                toolStripErrorMessage = new ToolStripLabel(text, null, false);
                toolStripErrorMessage.ForeColor = Color.Red;
                toolStripErrorMessage.Click += toolStripErrorMessage_clicked;
                toolStripErrorMessage.IsLink = true;
                toolStripErrorMessage.ActiveLinkColor = Color.Red;
                toolStripErrorMessage.LinkBehavior = LinkBehavior.AlwaysUnderline;
                toolStripErrorMessage.LinkColor = Color.Red;
                toolStripErrorMessage.VisitedLinkColor = Color.Red;
                toolStripErrorMessageItem = toolStripErrorMessage as ToolStripItem;
                app.StatusBarAddItem(toolStripErrorMessageItem);
                timeOutErrorMessage(toolStripErrorMessageItem, displayTime);
            }
        }
Example #26
0
 /// <summary>
 /// Modifies the specified CommandBar item
 /// </summary>
 public static void ExecuteFlagAction(ToolStripItem item, String action, Boolean value)
 {
     if (action.StartsWithOrdinal("Check:"))
     {
         if (item is ToolStripMenuItem)
         {
             ((ToolStripMenuItem)item).Checked = value;
         }
     }
     else if (action.StartsWithOrdinal("Uncheck:"))
     {
         if (item is ToolStripMenuItem)
         {
             ((ToolStripMenuItem)item).Checked = !value;
         }
     }
     else if (action.StartsWithOrdinal("Enable:"))
     {
         item.Enabled = value;
     }
     else if (action.StartsWithOrdinal("Disable:"))
     {
         item.Enabled = !value;
     }
     else if (action.StartsWithOrdinal("Visible:"))
     {
         item.Visible = value;
     }
     else if (action.StartsWithOrdinal("Invisible:"))
     {
         item.Visible = !value;
     }
 }
 /// <include file='doc\ToolStripArrowRenderEventArgs.uex' path='docs/doc[@for="ToolStripArrowRenderEventArgs.ToolStripArrowRenderEventArgs"]/*' />
 public ToolStripArrowRenderEventArgs(Graphics g, ToolStripItem toolStripItem, Rectangle arrowRectangle, Color arrowColor, ArrowDirection arrowDirection) {
     this.item = toolStripItem;
     this.graphics = g;
     this.arrowRect = arrowRectangle;
     this.defaultArrowColor = arrowColor;
     this.arrowDirection = arrowDirection;
 }
 protected override void InitializeItem(ToolStripItem item)
 {
     base.InitializeItem(item);
     // Set default blank image to look ok in high dpi
     if (item.Image == null && item.IsOnDropDown)
     {
         item.Image = PluginBase.MainForm.FindImage("559");
     }
     if (item is ToolStripButton)
     {
         Double scale = ScaleHelper.GetScale();
         if (scale >= 1.5)
         {
             item.Padding = new Padding(4, 2, 4, 2);
         }
         else if (scale >= 1.2)
         {
             item.Padding = new Padding(2, 1, 2, 1);
         }
         else if (renderer is ToolStripSystemRenderer && Win32.IsRunningOnWindows())
         {
             item.Padding = new Padding(2, 2, 2, 2);
         }
     }
     else if (item is ToolStripComboBoxEx)
     {
         ToolStripComboBoxEx comboBox = item as ToolStripComboBoxEx;
         comboBox.Margin = new Padding(2, 0, 2, 0);
         comboBox.FlatCombo.UseTheme = useTheme;
     }
 }
Example #29
0
        private void Init()
        {
            CutItem = SPMMenu.Items.CreateCut();
            CopyItem = SPMMenu.Items.CreateCopy();
            PasteItem = SPMMenu.Items.CreatePaste();
            DeleteItem = SPMMenu.Items.CreateDelete();
            RefreshItem = SPMMenu.Items.CreateRefresh();

            //this.Items.AddRange(new ToolStripItem[] {
            //    CutItem,
            //    CopyItem,
            //    PasteItem,
            //    DeleteItem,
            //    SPMMenu.Items.CreateSeparator(),
            //    RefreshItem
            //   });

            this.Items.AddRange(new ToolStripItem[] {
                DeleteItem,
                SPMMenu.Items.CreateSeparator(),
                RefreshItem
               });

               this.Name = "BasicMenuStrip";
        }
Example #30
0
        public void SetTools(ToolInfo[] toolInfos)
        {
            if (this.toolStripEx != null)
            {
                this.toolStripEx.Items.Clear();
            }

            this.imageList = new ImageList();
            this.imageList.ColorDepth = ColorDepth.Depth32Bit;
            this.imageList.TransparentColor = Utility.TransparentKey;

            this.toolStripEx.ImageList = this.imageList;

            ToolStripItem[] buttons = new ToolStripItem[toolInfos.Length];
            string toolTipFormat = PdnResources.GetString("ToolsControl.ToolToolTip.Format");

            for (int i = 0; i < toolInfos.Length; ++i)
            {
                ToolInfo toolInfo = toolInfos[i];
                ToolStripButton button = new ToolStripButton();

                int imageIndex = imageList.Images.Add(
                    toolInfo.Image.Reference,
                    imageList.TransparentColor);

                button.ImageIndex = imageIndex;
                button.Tag = toolInfo.ToolType;
                button.ToolTipText = string.Format(toolTipFormat, toolInfo.Name, char.ToUpperInvariant(toolInfo.HotKey).ToString());
                buttons[i] = button;
            }

            this.toolStripEx.Items.AddRange(buttons);
        }
        private void PerformClick()
        {
            SWF.ToolStripItem item = (SWF.ToolStripItem)Provider.Component;
            if (item.Owner != null && item.Owner.InvokeRequired)
            {
                item.Owner.BeginInvoke(new SWF.MethodInvoker(PerformClick));
                return;
            }

            var currentParent = item.OwnerItem as SWF.ToolStripMenuItem;

            // Invoking without a visible parent results in exceptions
            if (currentParent != null && !currentParent.DropDown.Visible)
            {
                return;
            }

            var  dropdown = item as SWF.ToolStripDropDownItem;
            bool hide     = false;

            if (dropdown != null)
            {
                hide = dropdown.Pressed;
            }

            // Make sure selection changes, or else another item's
            // dropdown menu might still appear.
            if (item.Owner != null)
            {
                item.Select();
            }

            item.PerformClick();

            // PerformClick does _not_ show/hide the DropDown, so
            // we must do this manually.  On Vista, clicking the
            // button appears to both Show the drop down and
            // Perform a click, so we emulate that behavior.
            if (dropdown != null && !(item is SWF.ToolStripSplitButton))
            {
                if (hide)
                {
                    dropdown.HideDropDown();
                }
                else
                {
                    dropdown.ShowDropDown();
                }
            }
        }
        private void tbStockItem_ButtonClick(System.Object eventSender, System.EventArgs eventArgs)
        {
            System.Windows.Forms.ToolStripItem Button = (System.Windows.Forms.ToolStripItem)eventSender;
            short x = 0;

            for (x = 0; x <= tbStockItem.Items.Count; x++)
            {
                ((ToolStripButton)tbStockItem.Items[x]).Checked = false;
            }
            tbStockItem.Tag = Button.Owner.Items.IndexOf(Button) - 1;
            //    buildDepartment
            //Button.Checked = True
            doLoad();
        }
Example #33
0
        internal ToolStripDropDown GetFirstDropDown(System.Windows.Forms.ToolStripItem currentItem)
        {
            if (!(currentItem.Owner is ToolStripDropDown))
            {
                return(null);
            }
            ToolStripDropDown owner = currentItem.Owner as ToolStripDropDown;

            while ((owner.OwnerItem != null) && (owner.OwnerItem.Owner is ToolStripDropDown))
            {
                owner = owner.OwnerItem.Owner as ToolStripDropDown;
            }
            return(owner);
        }
Example #34
0
 private void setObjectEvent(object obj)
 {
     if (hasToolTip(obj))
     {
         if (!_objEvents.Contains(obj))
         {
             if (obj is System.Windows.Forms.Control)
             {
                 System.Windows.Forms.Control ctrl = (System.Windows.Forms.Control)obj;
                 ctrl.MouseEnter += new EventHandler(ctrlMouseEnter);
                 ctrl.MouseLeave += new EventHandler(ctrlMouseLeave);
                 ctrl.MouseDown  += new MouseEventHandler(ctrlMouseDown);
                 _objEvents.Add(obj);
             }
             else if (obj is System.Windows.Forms.ToolStripItem)
             {
                 System.Windows.Forms.ToolStripItem anItem = (System.Windows.Forms.ToolStripItem)obj;
                 anItem.MouseEnter += new EventHandler(tsiMouseEnter);
                 anItem.MouseLeave += new EventHandler(ctrlMouseLeave);
                 anItem.MouseDown  += new MouseEventHandler(ctrlMouseDown);
                 _objEvents.Add(obj);
             }
         }
     }
     else
     {
         if (_objEvents.Contains(obj))
         {
             if (obj is System.Windows.Forms.Control)
             {
                 System.Windows.Forms.Control ctrl = (System.Windows.Forms.Control)obj;
                 ctrl.MouseEnter -= new EventHandler(ctrlMouseEnter);
                 ctrl.MouseLeave -= new EventHandler(ctrlMouseLeave);
                 ctrl.MouseDown  -= new MouseEventHandler(ctrlMouseDown);
                 _objEvents.Remove(obj);
             }
             else if (obj is System.Windows.Forms.ToolStripItem)
             {
                 System.Windows.Forms.ToolStripItem anItem = (System.Windows.Forms.ToolStripItem)obj;
                 anItem.MouseEnter -= new EventHandler(tsiMouseEnter);
                 anItem.MouseLeave -= new EventHandler(ctrlMouseLeave);
                 anItem.MouseDown  -= new MouseEventHandler(ctrlMouseDown);
                 _objEvents.Remove(obj);
             }
         }
     }
 }
Example #35
0
    // 创建托盘图标、添加选项
    void AddSystemTray()
    {
        _icon       = new SystemTray(_systemTrayIcon);
        _topmost    = _icon.AddItem("置顶显示", ToggleTopMost);
        _runOnStart = _icon.AddItem("开机自启", ToggleRunOnStartup);
        _icon.AddItem("重置位置", ResetPos);
        _icon.AddSeparator();
        _icon.AddItem("查看文档", OpenDoc);
        _icon.AddItem("检查更新", CheckUpdate);
        _icon.AddSeparator();
        _icon.AddItem("退出", Exit);
        _icon.AddDoubleClickEvent(ToggleTopMost);
        _icon.AddSingleClickEvent(ShowRole);

        _topmost.Image    = DataModel.Instance.Data.isTopMost ? _enableImage : null;
        _runOnStart.Image = DataModel.Instance.Data.isRunOnStartup ? _enableImage : null;
    }
Example #36
0
        /// <summary>
        /// 确保帮助菜单保持在最后面
        /// </summary>
        public void EnsureHelpItemLast()
        {
            System.Resources.ResourceManager resources =
                new System.Resources.ResourceManager("MapWinGIS.MainProgram.GlobalResource", System.Reflection.Assembly.GetExecutingAssembly());
            int i;
            int count = Program.frmMain.menuStrip1.Items.Count;

            for (i = 0; i < count; i++)
            {
                if (Program.frmMain.menuStrip1.Items[i].Text == resources.GetString("mnuHelp_Text"))
                {
                    System.Windows.Forms.ToolStripItem helpItem = Program.frmMain.menuStrip1.Items[i];
                    //移除再添加,系统会自动将帮助菜单添加到最后
                    Program.frmMain.menuStrip1.Items.RemoveAt(i);
                    Program.frmMain.menuStrip1.Items.Add(helpItem);
                }
            }
        }
        void contexMenuuu_ItemClicked(object sender, System.Windows.Forms.ToolStripItemClickedEventArgs e)
        {
            System.Windows.Forms.ToolStripItem item = e.ClickedItem;

            if (item.Text == "הדבק מתחרה")
            {
                if (VisualLeagueEvent.ClipBoardValue < 1000)
                {
                    // no contender was copied do nothing
                }
                else
                {
                    PasteVisualContender();
                    // delete the last contnder that was copied
                    VisualLeagueEvent.ClipBoardValue = 0;
                }
            }
        }
Example #38
0
 public static void LoadLogFiles(System.Windows.Forms.ToolStripItem DropItems, int Limit = 20)
 {
     //var menuParent = menuBar.Items["Help"];
     //var dropItems = ((ToolStripMenuItem)menuParent).DropDown.Items["Logs"];
     string[] listLogFiles = Directory.GetFiles("Logs");
     Limit = listLogFiles.Length > 20 ? 20 : listLogFiles.Length;
     ToolStripMenuItem[] toolFileItem = new ToolStripMenuItem[Limit];
     for (int i = 0; i < Limit; i++)
     {
         toolFileItem[i] = new ToolStripMenuItem();
         string[] splStr = listLogFiles[listLogFiles.Length - Limit + i].Split('\\');
         toolFileItem[i].Name = splStr[splStr.Length - 1];
         toolFileItem[i].Text = splStr[splStr.Length - 1];
     }
     ((ToolStripMenuItem)DropItems).DropDown.Items.Clear();
     ((ToolStripMenuItem)DropItems).DropDown.Items.AddRange(toolFileItem);
     ((ToolStripMenuItem)DropItems).DropDown.ItemClicked += OpenLogFiles_Click;
 }
 public static void Update(System.Windows.Forms.ToolStripItem toolStripItem, IToolStripItemCodon codon)
 {
     if (toolStripItem == null || codon == null)
     {
         Debug.Assert(false, "ToolStripItemDoozerHelper.Update , toolStripItem或codon为null");
         return;
     }
     toolStripItem.Text         = codon.Text;
     toolStripItem.Image        = codon.Image;
     toolStripItem.Alignment    = codon.Alignment;
     toolStripItem.AutoSize     = codon.AutoSize;
     toolStripItem.AutoToolTip  = codon.AutoToolTip;
     toolStripItem.Available    = codon.Available;
     toolStripItem.DisplayStyle = codon.DisplayStyle;
     if (codon.Width.HasValue)
     {
         toolStripItem.Width = codon.Width.Value;
     }
 }
Example #40
0
        /// <summary>
        /// 当鼠标点击,激活该菜单项
        /// </summary>
        public bool PerformClick(string name)
        {
            try
            {
                System.Windows.Forms.ToolStripItem menuItem = MenuTableItem(name);
                if (menuItem == null)
                {
                    return(false);
                }
                menuItem.PerformClick();
                return(true);
            }
            catch (Exception ex)
            {
                MapWinGIS.Utility.Logger.Dbg("在clsMenu.PerformClick(" + name + ")中发生一个错误:" + ex.ToString());
            }

            return(false);
        }
Example #41
0
        /// <summary>
        /// 在工具栏的指定位置后加入控件。
        /// </summary>
        /// <param name="toolStrip">工具栏。</param>
        /// <param name="ctrl">被加入的控件。</param>
        /// <param name="archor">指定的位置。</param>
        public static void AddControlAfter(
            this System.Windows.Forms.ToolStrip toolStrip,
            System.Windows.Forms.Control ctrl,
            System.Windows.Forms.ToolStripItem archor)
        {
            NotNull(toolStrip, "toolStrip");
            NotNull(ctrl, "ctrl");
            var host = new ToolStripControlHost(ctrl);

            if (archor != null)
            {
                var index = toolStrip.Items.IndexOf(archor);
                toolStrip.Items.Insert(index + 1, host);
            }
            else
            {
                toolStrip.Items.Add(host);
            }
        }
Example #42
0
 public ToolStripView(ToolStripCodon codon)
 {
     this.Renderer = UIHelper.ToolStripRenders.ControlToControlLight;
     Codon         = codon;
     codon.View    = this;
     if (codon != null && codon.Items != null)
     {
         foreach (IToolStripItemCodon toolStripItem in codon.Items)
         {
             System.Windows.Forms.ToolStripItem item =
                 toolStripItem.View as System.Windows.Forms.ToolStripItem;
             Debug.Assert(item != null, "item 为 null");
             if (item != null)
             {
                 this.Items.Add(item);
             }
         }
     }
 }
        /// <summary>
        /// 获取撤销步长列表框弹出的位置
        /// </summary>
        /// <param name="toolStripItem"></param>
        /// <returns></returns>
        private Point GetUndoEnginePopShowLocation(System.Windows.Forms.ToolStripItem toolStripItem)
        {
            Point point, toolStripPanelPoint;

            //point = new Point(toolStripItem.Owner.Location.X + toolStripItem.Bounds.Location.X,
            //    toolStripItem.Owner.Location.Y + toolStripItem.Bounds.Location.Y + toolStripItem.Height);
            //return this.PointToScreen(point);

            //撤销重做按钮是显示在主界面工具条上的,所以要用主界面的PointToScreen

            //要先把toolStripItem.Owner.Location属性PointToScreen后,再参与计算
            //对于主界面,还存在菜单栏,所以在计算坐标时也要考虑
            //注意:工具栏的Y坐标是0,是因为它在Workbench.Instance.ToolStripPanel中!Y轴要取工具栏主容器的坐标+工具栏本身的Y坐标
            //X轴也一样,要取ToolStripPanel的X坐标+工具栏的X坐标
            toolStripPanelPoint = _workbenchService.PointToScreen(_workbenchService.ToolStripPanelLocation);
            point = new Point(toolStripPanelPoint.X + toolStripItem.Owner.Location.X + toolStripItem.Bounds.Location.X,
                              toolStripPanelPoint.Y + toolStripItem.Owner.Location.Y + toolStripItem.Bounds.Location.Y + toolStripItem.Height);

            return(point);
        }
Example #44
0
 void System.ComponentModel.ISupportInitialize.EndInit()
 {
     System.Windows.Forms.ToolStripMenuItem toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     toolStripMenuItem.Name      = "deleteSelectedRowsToolStripMenuItem";
     toolStripMenuItem.Size      = new System.Drawing.Size(178, 22);
     toolStripMenuItem.Text      = "Delete Selected Rows";
     toolStripMenuItem.Click    += new System.EventHandler(deleteSelectedRowsToolStripMenuItem_Click);
     contextMenuStrip1           = new System.Windows.Forms.ContextMenuStrip();
     contextMenuStrip1.BackColor = System.Drawing.Color.FromArgb(224, 224, 224);
     System.Windows.Forms.ToolStripItem[] toolStripItemArr = new System.Windows.Forms.ToolStripItem[] { toolStripMenuItem };
     // contextMenuStrip1.Items.AddRange(toolStripItemArr);
     contextMenuStrip1.Name                  = "contextMenuStrip1";
     contextMenuStrip1.RenderMode            = System.Windows.Forms.ToolStripRenderMode.System;
     contextMenuStrip1.Size                  = new System.Drawing.Size(179, 48);
     columnHeaderContextMenuStrip            = new System.Windows.Forms.ContextMenuStrip();
     columnHeaderContextMenuStrip.BackColor  = System.Drawing.Color.FromArgb(224, 224, 224);
     columnHeaderContextMenuStrip.Name       = "columnHeaderContextMenuStrip";
     columnHeaderContextMenuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
     columnHeaderContextMenuStrip.Size       = new System.Drawing.Size(174, 32);
     if (AllowUserToDeleteRows || _HasCustomContextMenuItems)
     {
         ContextMenuStrip = contextMenuStrip1;
     }
     else
     {
         ContextMenuStrip = null;
     }
     rememberedAllowAddRow = AllowUserToAddRows;
     RefreshCustomEnabled();
     if (ColumnSettingsManager == null)
     {
         ColumnSettingsManager = Oranikle.Studio.Controls.StyledDataGridView.DefaultColumnSettingsManager;
     }
     if (ColumnSettingsManager != null)
     {
         ColumnSettingsManager.DgvEndInit(this);
     }
     ColumnWidthChanged += new System.Windows.Forms.DataGridViewColumnEventHandler(StyledDataGridView_ColumnWidthChanged);
 }
        /// <devdoc>
        ///  </devdoc>
        private void RenderSeparatorInternal(Graphics g, ToolStripItem item, Rectangle bounds, bool vertical)
        {
            VisualStyleElement separator = (vertical) ? VisualStyleElement.ToolBar.SeparatorHorizontal.Normal : VisualStyleElement.ToolBar.SeparatorVertical.Normal;

            if (ToolStripManager.VisualStylesEnabled &&
                (VisualStyleRenderer.IsElementDefined(separator)))
            {
                VisualStyleRenderer vsRenderer = VisualStyleRenderer;

                vsRenderer.SetParameters(separator.ClassName, separator.Part, GetItemState(item));
                vsRenderer.DrawBackground(g, bounds);
            }
            else
            {
                Color foreColor = item.ForeColor;
                Color backColor = item.BackColor;

                Pen  foreColorPen        = SystemPens.ControlDark;
                bool disposeForeColorPen = GetPen(foreColor, ref foreColorPen);

                try {
                    if (vertical)
                    {
                        if (bounds.Height >= 4)
                        {
                            bounds.Inflate(0, -2);   // scoot down 2PX and start drawing
                        }

                        bool rightToLeft = (item.RightToLeft == RightToLeft.Yes);
                        Pen  leftPen     = (rightToLeft) ?  SystemPens.ButtonHighlight : foreColorPen;
                        Pen  rightPen    = (rightToLeft) ?  foreColorPen : SystemPens.ButtonHighlight;

                        // Draw dark line
                        int startX = bounds.Width / 2;
                        g.DrawLine(leftPen, startX, bounds.Top, startX, bounds.Bottom);

                        // Draw highlight one pixel to the right
                        startX++;
                        g.DrawLine(rightPen, startX, bounds.Top, startX, bounds.Bottom);
                    }
                    else
                    {
                        //
                        // horizontal separator
                        if (bounds.Width >= 4)
                        {
                            bounds.Inflate(-2, 0);      // scoot over 2PX and start drawing
                        }

                        // Draw dark line
                        int startY = bounds.Height / 2;
                        g.DrawLine(foreColorPen, bounds.Left, startY, bounds.Right, startY);

                        // Draw highlight one pixel to the right
                        startY++;
                        g.DrawLine(SystemPens.ButtonHighlight, bounds.Left, startY, bounds.Right, startY);
                    }
                }
                finally {
                    if (disposeForeColorPen && foreColorPen != null)
                    {
                        foreColorPen.Dispose();
                    }
                }
            }
        }
 /// <include file='doc\ToolStripItemImageRenderEventArgs.uex' path='docs/doc[@for="ToolStripItemImageRenderEventArgs.ToolStripItemImageRenderEventArgs"]/*' />
 /// <devdoc>
 /// This class represents all the information to render the winbar
 /// </devdoc>
 public ToolStripItemImageRenderEventArgs(Graphics g, ToolStripItem item, Image image, Rectangle imageRectangle) : base(g, item)
 {
     this.image          = image;
     this.imageRectangle = imageRectangle;
 }
 public ToolStripItemImageRenderEventArgs(Graphics g, ToolStripItem item, Rectangle imageRectangle) : base(g, item)
 {
     this.image          = (item.RightToLeftAutoMirrorImage && (item.RightToLeft == RightToLeft.Yes)) ? item.MirroredImage : item.Image;
     this.imageRectangle = imageRectangle;
 }
 /// <devdoc>
 ///     translates the ToolStrip item state into a toolbar state, which is something the renderer understands
 /// </devdoc>
 private static int GetItemState(ToolStripItem item)
 {
     return((int)GetToolBarState(item));
 }
Example #49
0
        public virtual System.Windows.Forms.ToolStripItem[] buildMenu(List <MySQL.Base.MenuItem> menuItems, System.EventHandler handler)
        {
            System.Windows.Forms.ToolStripItem[] itemlist = new System.Windows.Forms.ToolStripItem[menuItems.Count];
            int i = 0;

            // rebuild the menu
            foreach (MySQL.Base.MenuItem subitem in menuItems)
            {
                Keys shortcut = convertShortcut(subitem.get_shortcut());


                switch (subitem.get_type())
                {
                case MenuItemType.MenuAction:
                case MenuItemType.MenuUnavailable:
                {
                    System.Windows.Forms.ToolStripMenuItem smitem;

                    smitem              = new System.Windows.Forms.ToolStripMenuItem();
                    smitem.Name         = subitem.getInternalName();
                    smitem.Text         = subitem.get_caption();
                    smitem.ShortcutKeys = shortcut;
                    smitem.Enabled      = subitem.get_enabled();
                    if (subitem.get_type() == MenuItemType.MenuUnavailable)
                    {
                        smitem.Image   = Resources.menu_se;
                        smitem.Enabled = false;
                    }
                    smitem.Click += handler;
                    itemlist[i++] = smitem;
                    break;
                }

                case MenuItemType.MenuCheck:
                case MenuItemType.MenuRadio:
                {
                    System.Windows.Forms.ToolStripMenuItem smitem;

                    smitem              = new System.Windows.Forms.ToolStripMenuItem();
                    smitem.Name         = subitem.getInternalName();
                    smitem.Text         = subitem.get_caption();
                    smitem.ShortcutKeys = shortcut;
                    smitem.Enabled      = subitem.get_enabled();
                    smitem.Checked      = subitem.get_checked();
                    smitem.Click       += handler;
                    itemlist[i++]       = smitem;
                    break;
                }

                case MenuItemType.MenuSeparator:
                    itemlist[i++] = new System.Windows.Forms.ToolStripSeparator();
                    break;

                case MenuItemType.MenuCascade:
                {
                    System.Windows.Forms.ToolStripMenuItem smitem;

                    smitem              = new System.Windows.Forms.ToolStripMenuItem();
                    smitem.Name         = subitem.getInternalName();
                    smitem.Text         = subitem.get_caption();
                    smitem.ShortcutKeys = shortcut;
                    smitem.Enabled      = subitem.get_enabled();
                    buildSubmenu(smitem, subitem.getInternalName(), subitem.get_subitems(), handler);
                    itemlist[i++] = smitem;
                    break;
                }

                default:
                    throw new Exception("bad item type");
                }
            }
            return(itemlist);
        }
Example #50
0
 /// <include file='doc\ToolStripItemCollection.uex' path='docs/doc[@for="ToolStripItemCollection.Contains"]/*' />
 public bool Contains(ToolStripItem value)
 {
     return(InnerList.Contains(value));
 }
 protected internal virtual void InitializeItem(ToolStripItem item)
 {
 }
Example #52
0
 /// <include file='doc\ToolStripItemCollection.uex' path='docs/doc[@for="ToolStripItemCollection.IndexOf"]/*' />
 public int IndexOf(ToolStripItem value)
 {
     return(InnerList.IndexOf(value));
 }
Example #53
0
 private void AddMenuItem(System.Windows.Forms.ToolStripItem item)
 {
     menuList.Add(item);
 }
        /// <summary>
        /// Initializes new instance.
        /// </summary>
        public PrintPreviewDialog()
            : base()
        {
            System.Windows.Forms.Form ppdForm = this as System.Windows.Forms.Form;
            if (ppdForm != null)
            {
                ppdForm.KeyPress  += new System.Windows.Forms.KeyPressEventHandler(ppdForm_KeyPress);
                ppdForm.Load      += new System.EventHandler(ppdForm_Load);
                ppdForm.Icon       = Resources.TransparentIcon;
                ppdForm.ShowIcon   = true;
                ppdForm.Text       = Resources.Caption;
                ppdForm.KeyPreview = true;
                for (int i = 0; i < ppdForm.Controls.Count; i++)
                {
                    System.Windows.Forms.Control   iControl   = ppdForm.Controls[i];
                    System.Windows.Forms.ToolStrip iToolstrip = iControl as System.Windows.Forms.ToolStrip;
                    if (iToolstrip != null)
                    {
                        for (int j = 0; j < iToolstrip.Items.Count; j++)
                        {
                            System.Windows.Forms.ToolStripItem jItem = iToolstrip.Items[j];
                            switch (jItem.Name)
                            {
                            case "printToolStripButton":
                                jItem.Text = Resources.Print;
                                break;

                            case "zoomToolStripSplitButton":
                                jItem.Text = Resources.Zoom;
                                break;

                            case "onepageToolStripButton":
                                jItem.Text = Resources.OnePage;
                                break;

                            case "twopagesToolStripButton":
                                jItem.Text = Resources.TwoPages;
                                break;

                            case "threepagesToolStripButton":
                                jItem.Text = Resources.ThreePages;
                                break;

                            case "fourpagesToolStripButton":
                                jItem.Text = Resources.FourPages;
                                break;

                            case "sixpagesToolStripButton":
                                jItem.Text = Resources.SixPages;
                                break;

                            case "closeToolStripButton":
                                jItem.Text = Resources.Close;
                                break;

                            case "pageToolStripLabel":
                                jItem.Text = Resources.Page;
                                break;

                            default:
                                break;
                            } //switch
                        }     //for(j)
                    }         //if
                }             //for(i)
            }                 //if
        }
 /// <summary>
 /// This class represents all the information to render the ToolStrip
 /// </summary>
 public ToolStripItemRenderEventArgs(Graphics g, ToolStripItem item)
 {
     Graphics = g;
     Item     = item;
 }
 private void InitializeComponent()
 {
     components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager componentResourceManager = new System.ComponentModel.ComponentResourceManager(typeof(Oranikle.Studio.Controls.CtrlRichTextbox));
     toolStrip1           = new System.Windows.Forms.ToolStrip();
     bttnFont             = new System.Windows.Forms.ToolStripButton();
     bttnColour           = new System.Windows.Forms.ToolStripButton();
     bttnBackgroundColour = new System.Windows.Forms.ToolStripButton();
     toolStripSeparator2  = new System.Windows.Forms.ToolStripSeparator();
     bttnBold             = new System.Windows.Forms.ToolStripButton();
     bttnItalic           = new System.Windows.Forms.ToolStripButton();
     bttnUnderline        = new System.Windows.Forms.ToolStripButton();
     toolStripSeparator1  = new System.Windows.Forms.ToolStripSeparator();
     bttnLeftAlign        = new System.Windows.Forms.ToolStripButton();
     bttnCentreAlign      = new System.Windows.Forms.ToolStripButton();
     bttnRightAlign       = new System.Windows.Forms.ToolStripButton();
     ctrlRtf                    = new Oranikle.Studio.Controls.RichTextBoxEx();
     contextMenuStrip1          = new System.Windows.Forms.ContextMenuStrip(components);
     boldToolStripMenuItem      = new System.Windows.Forms.ToolStripMenuItem();
     italicToolStripMenuItem    = new System.Windows.Forms.ToolStripMenuItem();
     underlineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     toolStripSeparator5        = new System.Windows.Forms.ToolStripSeparator();
     cutToolStripMenuItem       = new System.Windows.Forms.ToolStripMenuItem();
     copyToolStripMenuItem      = new System.Windows.Forms.ToolStripMenuItem();
     pasteToolStripMenuItem     = new System.Windows.Forms.ToolStripMenuItem();
     fontDialog1                = new System.Windows.Forms.FontDialog();
     colorDialog1               = new System.Windows.Forms.ColorDialog();
     toolStrip1.SuspendLayout();
     contextMenuStrip1.SuspendLayout();
     SuspendLayout();
     toolStrip1.BackColor = System.Drawing.Color.Transparent;
     toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
     System.Windows.Forms.ToolStripItem[] toolStripItemArr1 = new System.Windows.Forms.ToolStripItem[] {
         bttnBold,
         bttnItalic,
         bttnUnderline,
         toolStripSeparator1,
         bttnLeftAlign,
         bttnCentreAlign,
         bttnRightAlign,
         toolStripSeparator2,
         bttnFont,
         bttnColour,
         bttnBackgroundColour
     };
     toolStrip1.Items.AddRange(toolStripItemArr1);
     toolStrip1.Location            = new System.Drawing.Point(0, 0);
     toolStrip1.Name                = "toolStrip1";
     toolStrip1.RenderMode          = System.Windows.Forms.ToolStripRenderMode.System;
     toolStrip1.Size                = new System.Drawing.Size(460, 25);
     toolStrip1.TabIndex            = 0;
     toolStrip1.Text                = "toolStrip1";
     bttnFont.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     bttnFont.Image                 = Oranikle.Studio.Controls.Properties.Resources.Icon_Font_16;
     bttnFont.ImageTransparentColor = System.Drawing.Color.White;
     bttnFont.Name                              = "bttnFont";
     bttnFont.Size                              = new System.Drawing.Size(23, 22);
     bttnFont.Text                              = "toolStripButton4";
     bttnFont.ToolTipText                       = "Font";
     bttnFont.Click                            += new System.EventHandler(bttnFont_Click);
     bttnColour.DisplayStyle                    = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     bttnColour.Image                           = Oranikle.Studio.Controls.Properties.Resources.Icon_Color_16;
     bttnColour.ImageTransparentColor           = System.Drawing.Color.White;
     bttnColour.Name                            = "bttnColour";
     bttnColour.Size                            = new System.Drawing.Size(23, 22);
     bttnColour.Text                            = "toolStripButton5";
     bttnColour.ToolTipText                     = "Colour";
     bttnColour.Click                          += new System.EventHandler(bttnColour_Click);
     bttnBackgroundColour.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     bttnBackgroundColour.Image                 = Oranikle.Studio.Controls.Properties.Resources.Icon_FontColor_16;
     bttnBackgroundColour.ImageTransparentColor = System.Drawing.Color.Magenta;
     bttnBackgroundColour.Name                  = "bttnBackgroundColour";
     bttnBackgroundColour.Size                  = new System.Drawing.Size(23, 22);
     bttnBackgroundColour.Text                  = "toolStripButton1";
     bttnBackgroundColour.ToolTipText           = "Background Colour";
     bttnBackgroundColour.Click                += new System.EventHandler(bttnBackgroundColour_Click);
     toolStripSeparator2.Name                   = "toolStripSeparator2";
     toolStripSeparator2.Size                   = new System.Drawing.Size(6, 25);
     bttnBold.DisplayStyle                      = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
     bttnBold.Font                              = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
     bttnBold.Image                             = (System.Drawing.Image)componentResourceManager.GetObject("bttnBold.Image");
     bttnBold.ImageTransparentColor             = System.Drawing.Color.Magenta;
     bttnBold.Name                              = "bttnBold";
     bttnBold.Size                              = new System.Drawing.Size(23, 22);
     bttnBold.Text                              = "B";
     bttnBold.ToolTipText                       = "Bold";
     bttnBold.Click                            += new System.EventHandler(bttnBold_Click);
     bttnItalic.DisplayStyle                    = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
     bttnItalic.Font                            = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, 0);
     bttnItalic.Image                           = (System.Drawing.Image)componentResourceManager.GetObject("bttnItalic.Image");
     bttnItalic.ImageTransparentColor           = System.Drawing.Color.Magenta;
     bttnItalic.Name                            = "bttnItalic";
     bttnItalic.Size                            = new System.Drawing.Size(23, 22);
     bttnItalic.Text                            = "I";
     bttnItalic.ToolTipText                     = "Italic";
     bttnItalic.Click                          += new System.EventHandler(bttnItalic_Click);
     bttnUnderline.BackColor                    = System.Drawing.Color.Transparent;
     bttnUnderline.DisplayStyle                 = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
     bttnUnderline.Font                         = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, 0);
     bttnUnderline.Image                        = (System.Drawing.Image)componentResourceManager.GetObject("bttnUnderline.Image");
     bttnUnderline.ImageTransparentColor        = System.Drawing.Color.Magenta;
     bttnUnderline.Name                         = "bttnUnderline";
     bttnUnderline.Size                         = new System.Drawing.Size(23, 22);
     bttnUnderline.Text                         = "U";
     bttnUnderline.ToolTipText                  = "Underline";
     bttnUnderline.Click                       += new System.EventHandler(bttnUnderline_Click);
     toolStripSeparator1.Name                   = "toolStripSeparator1";
     toolStripSeparator1.Size                   = new System.Drawing.Size(6, 25);
     bttnLeftAlign.DisplayStyle                 = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     bttnLeftAlign.Image                        = Oranikle.Studio.Controls.Properties.Resources.Icon_AlignMiddleLeft_16;
     bttnLeftAlign.ImageTransparentColor        = System.Drawing.Color.Black;
     bttnLeftAlign.Name                         = "bttnLeftAlign";
     bttnLeftAlign.Size                         = new System.Drawing.Size(23, 22);
     bttnLeftAlign.Text                         = "toolStripButton1";
     bttnLeftAlign.ToolTipText                  = "Align Left";
     bttnLeftAlign.Click                       += new System.EventHandler(bttnLeftAlign_Click);
     bttnCentreAlign.DisplayStyle               = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     bttnCentreAlign.Image                      = Oranikle.Studio.Controls.Properties.Resources.Icon_AlignMiddleCenter_16;
     bttnCentreAlign.ImageTransparentColor      = System.Drawing.Color.Black;
     bttnCentreAlign.Name                       = "bttnCentreAlign";
     bttnCentreAlign.Size                       = new System.Drawing.Size(23, 22);
     bttnCentreAlign.Text                       = "toolStripButton2";
     bttnCentreAlign.ToolTipText                = "Align Center";
     bttnCentreAlign.Click                     += new System.EventHandler(bttnCentreAlign_Click);
     bttnRightAlign.DisplayStyle                = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
     bttnRightAlign.Image                       = Oranikle.Studio.Controls.Properties.Resources.Icon_AlignMiddleRight_16;
     bttnRightAlign.ImageTransparentColor       = System.Drawing.Color.Black;
     bttnRightAlign.Name                        = "bttnRightAlign";
     bttnRightAlign.Size                        = new System.Drawing.Size(23, 22);
     bttnRightAlign.Text                        = "toolStripButton3";
     bttnRightAlign.ToolTipText                 = "Align Right";
     bttnRightAlign.Click                      += new System.EventHandler(bttnRightAlign_Click);
     ctrlRtf.ContextMenuStrip                   = contextMenuStrip1;
     ctrlRtf.Dock     = System.Windows.Forms.DockStyle.Fill;
     ctrlRtf.Location = new System.Drawing.Point(0, 25);
     ctrlRtf.Name     = "ctrlRtf";
     ctrlRtf.Size     = new System.Drawing.Size(460, 227);
     ctrlRtf.TabIndex = 1;
     ctrlRtf.Text     = "";
     System.Windows.Forms.ToolStripItem[] toolStripItemArr2 = new System.Windows.Forms.ToolStripItem[] {
         boldToolStripMenuItem,
         italicToolStripMenuItem,
         underlineToolStripMenuItem,
         toolStripSeparator5,
         cutToolStripMenuItem,
         copyToolStripMenuItem,
         pasteToolStripMenuItem
     };
     contextMenuStrip1.Items.AddRange(toolStripItemArr2);
     contextMenuStrip1.Name                  = "contextMenuStrip1";
     contextMenuStrip1.Size                  = new System.Drawing.Size(159, 142);
     boldToolStripMenuItem.Name              = "boldToolStripMenuItem";
     boldToolStripMenuItem.ShortcutKeys      = System.Windows.Forms.Keys.RButton | System.Windows.Forms.Keys.Control;
     boldToolStripMenuItem.Size              = new System.Drawing.Size(158, 22);
     boldToolStripMenuItem.Text              = "Bold";
     boldToolStripMenuItem.Click            += new System.EventHandler(boldToolStripMenuItem_Click);
     italicToolStripMenuItem.Name            = "italicToolStripMenuItem";
     italicToolStripMenuItem.ShortcutKeys    = System.Windows.Forms.Keys.LButton | System.Windows.Forms.Keys.Back | System.Windows.Forms.Keys.Control;
     italicToolStripMenuItem.Size            = new System.Drawing.Size(158, 22);
     italicToolStripMenuItem.Text            = "Italic";
     italicToolStripMenuItem.Click          += new System.EventHandler(italicToolStripMenuItem_Click);
     underlineToolStripMenuItem.Name         = "underlineToolStripMenuItem";
     underlineToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.LButton | System.Windows.Forms.Keys.MButton | System.Windows.Forms.Keys.ShiftKey | System.Windows.Forms.Keys.Control;
     underlineToolStripMenuItem.Size         = new System.Drawing.Size(158, 22);
     underlineToolStripMenuItem.Text         = "Underline";
     underlineToolStripMenuItem.Click       += new System.EventHandler(underlineToolStripMenuItem_Click);
     toolStripSeparator5.Name                = "toolStripSeparator5";
     toolStripSeparator5.Size                = new System.Drawing.Size(155, 6);
     cutToolStripMenuItem.Name               = "cutToolStripMenuItem";
     cutToolStripMenuItem.ShortcutKeys       = System.Windows.Forms.Keys.Back | System.Windows.Forms.Keys.ShiftKey | System.Windows.Forms.Keys.Control;
     cutToolStripMenuItem.Size               = new System.Drawing.Size(158, 22);
     cutToolStripMenuItem.Text               = "Cut";
     cutToolStripMenuItem.Click             += new System.EventHandler(cutToolStripMenuItem_Click);
     copyToolStripMenuItem.Name              = "copyToolStripMenuItem";
     copyToolStripMenuItem.ShortcutKeys      = System.Windows.Forms.Keys.LButton | System.Windows.Forms.Keys.RButton | System.Windows.Forms.Keys.Control;
     copyToolStripMenuItem.Size              = new System.Drawing.Size(158, 22);
     copyToolStripMenuItem.Text              = "Copy";
     copyToolStripMenuItem.Click            += new System.EventHandler(copyToolStripMenuItem_Click);
     pasteToolStripMenuItem.Name             = "pasteToolStripMenuItem";
     pasteToolStripMenuItem.ShortcutKeys     = System.Windows.Forms.Keys.RButton | System.Windows.Forms.Keys.MButton | System.Windows.Forms.Keys.ShiftKey | System.Windows.Forms.Keys.Control;
     pasteToolStripMenuItem.Size             = new System.Drawing.Size(158, 22);
     pasteToolStripMenuItem.Text             = "Paste";
     pasteToolStripMenuItem.Click           += new System.EventHandler(pasteToolStripMenuItem_Click);
     AutoScaleMode  = System.Windows.Forms.AutoScaleMode.None;
     base.BackColor = System.Drawing.Color.Transparent;
     Controls.Add(ctrlRtf);
     Controls.Add(toolStrip1);
     Name = "CtrlRichTextbox";
     Size = new System.Drawing.Size(460, 252);
     toolStrip1.ResumeLayout(false);
     toolStrip1.PerformLayout();
     contextMenuStrip1.ResumeLayout(false);
     ResumeLayout(false);
     PerformLayout();
 }
Example #57
0
        /// <summary>
        /// Рекурсивно перевести элементы управления Windows-формы
        /// </summary>
        private static void TranslateWinControls(IList controls, WinForms.ToolTip toolTip,
                                                 Dictionary <string, ControlInfo> controlInfoDict)
        {
            if (controls == null)
            {
                return;
            }

            foreach (object elem in controls)
            {
                ControlInfo controlInfo;

                if (elem is WinForms.Control)
                {
                    // обработка обычного элемента управления
                    WinForms.Control control = (WinForms.Control)elem;
                    if (!string.IsNullOrEmpty(control.Name) /*например, поле ввода и кнопки NumericUpDown*/ &&
                        controlInfoDict.TryGetValue(control.Name, out controlInfo))
                    {
                        if (controlInfo.Text != null)
                        {
                            control.Text = controlInfo.Text;
                        }

                        if (controlInfo.ToolTip != null && toolTip != null)
                        {
                            toolTip.SetToolTip(control, controlInfo.ToolTip);
                        }

                        if (controlInfo.Items != null && elem is WinForms.ComboBox)
                        {
                            WinForms.ComboBox comboBox = (WinForms.ComboBox)elem;
                            int cnt = Math.Min(comboBox.Items.Count, controlInfo.Items.Count);
                            for (int i = 0; i < cnt; i++)
                            {
                                string itemText = controlInfo.Items[i];
                                if (itemText != null)
                                {
                                    comboBox.Items[i] = itemText;
                                }
                            }
                        }
                    }

                    if (elem is WinForms.MenuStrip)
                    {
                        // запуск обработки элементов меню
                        WinForms.MenuStrip menuStrip = (WinForms.MenuStrip)elem;
                        TranslateWinControls(menuStrip.Items, toolTip, controlInfoDict);
                    }
                    else if (elem is WinForms.ToolStrip)
                    {
                        // запуск обработки элементов панели инструментов
                        WinForms.ToolStrip toolStrip = (WinForms.ToolStrip)elem;
                        TranslateWinControls(toolStrip.Items, toolTip, controlInfoDict);
                    }
                    else if (elem is WinForms.DataGridView)
                    {
                        // запуск обработки столбцов таблицы
                        WinForms.DataGridView dataGridView = (WinForms.DataGridView)elem;
                        TranslateWinControls(dataGridView.Columns, toolTip, controlInfoDict);
                    }
                    else if (elem is WinForms.ListView)
                    {
                        // запуск обработки столбцов списка
                        WinForms.ListView listView = (WinForms.ListView)elem;
                        TranslateWinControls(listView.Columns, toolTip, controlInfoDict);
                    }

                    // запуск обработки дочерних элементов
                    if (control.HasChildren)
                    {
                        TranslateWinControls(control.Controls, toolTip, controlInfoDict);
                    }
                }
                else if (elem is WinForms.ToolStripItem)
                {
                    // обработка элемента меню или элемента панели инструментов
                    WinForms.ToolStripItem item = (WinForms.ToolStripItem)elem;
                    if (controlInfoDict.TryGetValue(item.Name, out controlInfo))
                    {
                        if (controlInfo.Text != null)
                        {
                            item.Text = controlInfo.Text;
                        }
                        if (controlInfo.ToolTip != null)
                        {
                            item.ToolTipText = controlInfo.ToolTip;
                        }
                    }

                    if (elem is WinForms.ToolStripMenuItem)
                    {
                        // запуск обработки элементов подменю
                        WinForms.ToolStripMenuItem menuItem = (WinForms.ToolStripMenuItem)elem;
                        if (menuItem.HasDropDownItems)
                        {
                            TranslateWinControls(menuItem.DropDownItems, toolTip, controlInfoDict);
                        }
                    }
                }
                else if (elem is WinForms.DataGridViewColumn)
                {
                    // обработка столбца таблицы
                    WinForms.DataGridViewColumn column = (WinForms.DataGridViewColumn)elem;
                    if (controlInfoDict.TryGetValue(column.Name, out controlInfo) && controlInfo.Text != null)
                    {
                        column.HeaderText = controlInfo.Text;
                    }
                }
                else if (elem is WinForms.ColumnHeader)
                {
                    // обработка столбца списка
                    WinForms.ColumnHeader columnHeader = (WinForms.ColumnHeader)elem;
                    if (controlInfoDict.TryGetValue(columnHeader.Name, out controlInfo) && controlInfo.Text != null)
                    {
                        columnHeader.Text = controlInfo.Text;
                    }
                }
            }
        }
Example #58
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.SetStyle(
                System.Windows.Forms.ControlStyles.UserPaint |
                System.Windows.Forms.ControlStyles.AllPaintingInWmPaint |
                System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer,
                true);
            this.timer          = new System.Windows.Forms.Timer();
            this.timer.Interval = 200;
            this.timer.Tick    += this.OnTick;
            //Animation
            this.MI_animation = new System.Windows.Forms.ToolStripMenuItem();
            //this.MI_animation.Text = "Animation";
            this.MI_animation.Click += SelectNewFile;
            this.MI_animation.Image  = new Bitmap("Animation.png");

            this.MI_animation.Size    = new Size(100, 20);
            MI_animation.ImageAlign   = ContentAlignment.MiddleLeft;
            MI_animation.ImageScaling = ToolStripItemImageScaling.None;
            //Sound

            this.MI_sound = new System.Windows.Forms.ToolStripMenuItem();

            //this.MI_sound.Text = "Sound";
            this.MI_sound.Click += SelectNewFileSound;
            this.MI_sound.Image  = new Bitmap("Sound.png");

            this.MI_sound.Size    = new Size(100, 20);
            MI_sound.ImageAlign   = ContentAlignment.MiddleLeft;
            MI_sound.ImageScaling = ToolStripItemImageScaling.None;

            //Config

            this.MI_config = new System.Windows.Forms.ToolStripMenuItem();
            //this.MI_config.Text = "Config";
            this.MI_config.Click += OpenConfigForm;
            this.MI_config.Image  = new Bitmap("Config.png");

            this.MI_config.Size    = new Size(100, 20);
            MI_config.ImageAlign   = ContentAlignment.MiddleLeft;
            MI_config.ImageScaling = ToolStripItemImageScaling.None;
            //HELP

            this.MI_help = new System.Windows.Forms.ToolStripMenuItem();
            //this.MI_help.Text = "Help";
            this.MI_help.Image   = new Bitmap("Help.png");
            this.MI_help.Size    = new Size(100, 20);
            MI_help.ImageAlign   = ContentAlignment.MiddleLeft;
            MI_help.ImageScaling = ToolStripItemImageScaling.None;

            this.MI_help.Click += OpenHelpDialog;
            this.MS_toolbar     = new System.Windows.Forms.MenuStrip();
            this.MS_toolbar.Items.Add(this.MI_animation);
            this.MS_toolbar.Items.Add(this.MI_sound);
            this.MS_toolbar.Items.Add(this.MI_config);

            this.MS_toolbar.Items.Add(this.MI_help);
            this.MS_toolbar.BackColor = Color.FromArgb(255, 100, 100, 100);
            this.components           = new System.ComponentModel.Container();
            this.Controls.Add(MS_toolbar);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize    = new System.Drawing.Size(800, 450);
            this.Icon          = new System.Drawing.Icon("PixelPlayer.ico");
            this.Text          = "Pixel Animation Tester";
            this.BackColor     = Color.FromArgb(255, 100, 100, 100);
        }
Example #59
0
 protected override void InitializeItem(System.Windows.Forms.ToolStripItem item)
 {
     base.InitializeItem(item);
     item.ForeColor = Color.Black;
 }
Example #60
0
        /// <summary>
        /// UpdateControls
        ///
        /// UpdateControls enables and disables the menuitems of the application depending of
        /// camera is connected to the computer or not.
        /// </summary>
        private void UpdateControls()
        {
            bool IsDeviceValid = false;

            IsDeviceValid = icImagingControl1.DeviceValid;
            imageToolStripMenuItem.Enabled     = IsDeviceValid;
            writeAviToolStripMenuItem.Enabled  = IsDeviceValid;
            saveImageToolStripMenuItem.Enabled = IsDeviceValid;
            playToolStripMenuItem.Enabled      = IsDeviceValid;
            stopToolStripMenuItem.Enabled      = IsDeviceValid;
            ToolbarPlayButton.Enabled          = IsDeviceValid;
            ToolBarStopButton.Enabled          = IsDeviceValid;

            externalTriggerToolStripMenuItem.Enabled = false;
            ToolBarTriggerButton.Enabled             = false;


            if (IsDeviceValid)
            {
                playToolStripMenuItem.Enabled = !icImagingControl1.LiveVideoRunning;
                stopToolStripMenuItem.Enabled = !playToolStripMenuItem.Enabled;
                ToolbarPlayButton.Enabled     = !icImagingControl1.LiveVideoRunning;
                ToolBarStopButton.Enabled     = !ToolbarPlayButton.Enabled;

                if (icImagingControl1.DeviceTriggerAvailable)
                {
                    externalTriggerToolStripMenuItem.Enabled = true;
                    ToolBarTriggerButton.Enabled             = true;
                    externalTriggerToolStripMenuItem.Checked = icImagingControl1.DeviceTrigger;
                    ToolBarTriggerButton.Checked             = icImagingControl1.DeviceTrigger;
                }

                if (icImagingControl1.InputChannelAvailable)
                {
                    //Create the sub menus that allow to select the input channels.
                    ToolBarInputChannel.DropDownItems.Clear();
                    inputChannelsToolStripMenuItem.DropDown.Items.Clear();
                    inputChannelsToolStripMenuItem.Enabled = true;
                    ToolBarInputChannel.Enabled            = true;

                    foreach (InputChannel s in icImagingControl1.InputChannels)
                    {
                        System.Windows.Forms.ToolStripItem mitem = null;

                        // Add the input channel as menu item to the main menu
                        //mitem = inputChannelsToolStripMenuItem.DropDown.Items.Add(s.ToString());

                        mitem = inputChannelsToolStripMenuItem.DropDownItems.Add(s.ToString());

                        if (icImagingControl1.InputChannel == s.ToString())
                        {
                            ToolStripMenuItem i = (ToolStripMenuItem)mitem;
                            i.Checked = true;
                        }
                        mitem.Click += new System.EventHandler(mnuInputChannelChild_Click);

                        // Add the input channel as menu item to the toolbar button's context menu
                        mitem = ToolBarInputChannel.DropDown.Items.Add(s.ToString());
                        if (icImagingControl1.InputChannel == s.ToString())
                        {
                            ToolStripMenuItem i = (ToolStripMenuItem)mitem;
                            i.Checked = true;
                        }
                        mitem.Click += new System.EventHandler(mnuInputChannelChild_Click);
                    }
                }
                else
                {
                    // Remove the input channels from the submenus.
                    ToolBarInputChannel.DropDownItems.Clear();
                    inputChannelsToolStripMenuItem.DropDown.Items.Clear();
                    inputChannelsToolStripMenuItem.Enabled = false;
                    ToolBarInputChannel.Enabled            = false;
                }
            }
            ToolBarSnapButton.Enabled       = IsDeviceValid;
            ToolBarAVIButton.Enabled        = IsDeviceValid;
            ToolBarPropertiesButton.Enabled = IsDeviceValid;
        }