當前位置: 首頁>>代碼示例>>C#>>正文


C# Forms.ToolStripItem類代碼示例

本文整理匯總了C#中System.Windows.Forms.ToolStripItem的典型用法代碼示例。如果您正苦於以下問題:C# ToolStripItem類的具體用法?C# ToolStripItem怎麽用?C# ToolStripItem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ToolStripItem類屬於System.Windows.Forms命名空間,在下文中一共展示了ToolStripItem類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: MapControlAction

 public MapControlAction(MapControl control, DisplayToolId id, ToolStripItem[] items)
 {
     m_Control = control;
     m_ToolId = id;
     m_Elements = new UserActionSupport(items);
     m_Elements.SetHandler(Do);
 }
開發者ID:steve-stanton,項目名稱:backsight,代碼行數:7,代碼來源:MapControlAction.cs

示例2: VerifyMenuItemTextAndChecked

		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");
		}
開發者ID:sillsdev,項目名稱:FieldWorks,代碼行數:7,代碼來源:InMemoryLogicTest.cs

示例3: Add

        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;
            }
        }
開發者ID:burstas,項目名稱:rmps,代碼行數:25,代碼來源:CatTreeVisibleAction.cs

示例4: Add

        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;
            }
        }
開發者ID:burstas,項目名稱:rmps,代碼行數:26,代碼來源:ProPatternAction.cs

示例5: Add

 public void Add(ToolStripItem[] toolStripItems,
     MenuItem[] menuItems,
     EventHandler clickDelegate,
     ValidateCommand validateDelegate)
 {
     _commands.Add(new Command(toolStripItems, menuItems, clickDelegate, validateDelegate));
 }
開發者ID:applejian,項目名稱:cyberduck,代碼行數:7,代碼來源:Commands.cs

示例6: BeginScrollTimer

 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;
     }
 }
開發者ID:KnowNo,項目名稱:test-code-backup,代碼行數:30,代碼來源:DropDownMenuDropTarget.cs

示例7: Add

        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;
            }
        }
開發者ID:burstas,項目名稱:rmps,代碼行數:25,代碼來源:ItemGroup.cs

示例8: SetTools

        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);
        }
開發者ID:metadeta96,項目名稱:openpdn,代碼行數:33,代碼來源:ToolsControl.cs

示例9: AddTabPanel

 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;
 }
開發者ID:labeuze,項目名稱:source,代碼行數:30,代碼來源:PanelTabControl.cs

示例10: ToolStripTemplateNode

 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) };
 }
開發者ID:Reegenerator,項目名稱:Sample-CustomizeDatasetCS,代碼行數:32,代碼來源:ToolStripTemplateNode.cs

示例11: AddRange

 public void AddRange(ToolStripItem[] value)
 {
     for (int i = 0; i < value.Length; i++)
     {
         this.Add(value[i]);
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:7,代碼來源:CustomMenuItemCollection.cs

示例12: AddItem

 /// <summary>
 /// The add item.
 /// </summary>
 /// <param name="item">
 /// The item.
 /// </param>
 public void AddItem(ToolStripItem item)
 {
     if (item != null)
     {
         this._newItems.Add(item);
     }
 }
開發者ID:tu-tran,項目名稱:FareLiz,代碼行數:13,代碼來源:FlightDataListViewEventHandlers.cs

示例13: CombineMenusWithoutAdapterMenuItem

        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);
        }
開發者ID:lishxi,項目名稱:_SharpMap,代碼行數:26,代碼來源:MenuItemContextMenuStripAdapterTest.cs

示例14: ToolStripArrowRenderEventArgs

 /// <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;
 }
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:8,代碼來源:ToolStripArrowRenderEventArgs.cs

示例15: Init

        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";
        }
開發者ID:lucaslra,項目名稱:SPM,代碼行數:25,代碼來源:MenuStripStandard.cs


注:本文中的System.Windows.Forms.ToolStripItem類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。