当前位置: 首页>>代码示例>>C#>>正文


C# Forms.ToolBarButton类代码示例

本文整理汇总了C#中System.Windows.Forms.ToolBarButton的典型用法代码示例。如果您正苦于以下问题:C# ToolBarButton类的具体用法?C# ToolBarButton怎么用?C# ToolBarButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ToolBarButton类属于System.Windows.Forms命名空间,在下文中一共展示了ToolBarButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IDialog

        public IDialog()
            : base()
        {
            // Button
            resultButton = new ResultButton();
            this.Controls.Add(resultButton);

            this.toolBar = new System.Windows.Forms.ToolBar();
            this.tbOkButton = new System.Windows.Forms.ToolBarButton();
            this.tbCancelButton = new System.Windows.Forms.ToolBarButton();

            //
            // toolBar
            //
            this.toolBar.Buttons.Add(this.tbOkButton);
            this.toolBar.Buttons.Add(this.tbCancelButton);
            this.toolBar.Name = "toolBar";
            this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick);

            this.Controls.Add(this.toolBar);

            // Toolbar
            string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
            ToolbarMaker.ToolBar = toolBar;
            ToolbarMaker.AddIcon(appPath + @"\Icons\tbOk");
            ToolbarMaker.AddIcon(appPath + @"\Icons\tbCancel");

            this.TopMost = true;
        }
开发者ID:ntj,项目名称:GravurGIS,代码行数:29,代码来源:IDialog.cs

示例2: Install

		public void Install(IWorkspace workspace)
		{
			MenuItem item = new MenuItem("P&roject");
			workspace.MainMenu.MenuItems.Add(item);

			ToolBar toolbar = workspace.MainToolBar;

			newAction.Install(workspace, item, toolbar);
			openAction.Install(workspace, item, toolbar);
			saveAction.Install(workspace, item, toolbar);

			MenuItem menuSep = new MenuItem("-");
			item.MenuItems.Add(menuSep);

			generateAction.Install(workspace, item, toolbar);

			menuSep = new MenuItem("-");
			item.MenuItems.Add(menuSep);

			exitAction.Install(workspace, item, toolbar);

			ToolBarButton sep = new ToolBarButton();
			sep.Style = ToolBarButtonStyle.Separator;
			
			toolbar.Buttons.Add( sep );
		}
开发者ID:ralescano,项目名称:castle,代码行数:26,代码来源:FileActionSet.cs

示例3: MyWindow

        public MyWindow()
            : base()
        {
            Menu = new MainMenu();
            Menu.MenuItems.Add("File");
            Menu.MenuItems.Add("Edit");
            Menu.MenuItems.Add("View");
            Menu.MenuItems.Add("Help");

            Bitmap bm = new Bitmap(GetType(), "SimpleToolbar.bmp");
            ImageList imglist = new ImageList();
            imglist.Images.AddStrip(bm);
            imglist.TransparentColor = Color.LightBlue;
            ToolBar tb = new ToolBar();
            tb.Parent = this;
            tb.ShowToolTips = true;
            string[] astr = { "New", "Open", "Save", "Print", "Cut", "Copy", "Paste" };
            for (int i = 0; i < 7; i++)
            {
                ToolBarButton tbb = new ToolBarButton();
                tbb.ImageIndex = i;
                tbb.ToolTipText = astr[i];
                tb.Buttons.Add(tbb);
            }
        }
开发者ID:kmrashish,项目名称:DotNetLab,代码行数:25,代码来源:Program.cs

示例4: InitializeMyToolBar

		static public void InitializeMyToolBar(Form form)
		{
			// Create and initialize the ToolBar and ToolBarButton controls.
			ToolBar toolBar1 = new ToolBar();
			ToolBarButton toolBarButton1 = new ToolBarButton();
			ToolBarButton toolBarButton2 = new ToolBarButton();
			ToolBarButton toolBarButton3 = new ToolBarButton();
	
			// Set the Text properties of the ToolBarButton controls.
			toolBarButton1.Text = "Open";
			toolBarButton2.Text = "Save";
			toolBarButton3.Text = "Print";
	
			// Add the ToolBarButton controls to the ToolBar.
			toolBar1.Buttons.Add(toolBarButton1);
			toolBar1.Buttons.Add(toolBarButton2);
			toolBar1.Buttons.Add(toolBarButton3);
	
			//Add the event-handler delegate.
			toolBar1.ButtonClick += new ToolBarButtonClickEventHandler (
			  toolBar1_ButtonClick);
	
			// Add the ToolBar to the Form.
			form.Controls.Add(toolBar1);
 		}
开发者ID:mono,项目名称:uia2atk,代码行数:25,代码来源:FormTest.cs

示例5: SetWholeDropDown

        public void SetWholeDropDown(ToolBarButton button)
        {
            if (button == null)
            {
                throw new ArgumentNullException("button");
            }

            if (!this.wholeDropDownButtons.Contains(button))
            {
                this.wholeDropDownButtons.Add(button);

                if (!OsUtils.Windows())
                {
                    // Append a down arrow as BTNS_WHOLEDROPDOWN is only supported under Windows
                    button.Text += " ▾";
                }
            }

            NativeMethods.TBBUTTONINFO buttonInfo = default(NativeMethods.TBBUTTONINFO);

            buttonInfo.cbSize = Marshal.SizeOf(buttonInfo);
            buttonInfo.dwMask = NativeMethods.TBIF_STYLE | NativeMethods.TBIF_BYINDEX;
            buttonInfo.fsStyle = NativeMethods.BTNS_WHOLEDROPDOWN | NativeMethods.BTNS_AUTOSIZE;

            NativeMethods.SendMessage(this.Handle, NativeMethods.TB_SETBUTTONINFO, (IntPtr)this.Buttons.IndexOf(button), ref buttonInfo);
        }
开发者ID:ribbons,项目名称:RadioDownloader,代码行数:26,代码来源:ExtToolBar.cs

示例6: TBBStylesForm

		public TBBStylesForm()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			string[] astrTBB = {"Cut", "Copy", "Paste", "", "Messages", "", "Help"};
			ToolBarButtonStyle[] atbbStyles = {ToolBarButtonStyle.PushButton,
				ToolBarButtonStyle.PushButton, ToolBarButtonStyle.PushButton,
				ToolBarButtonStyle.Separator, ToolBarButtonStyle.ToggleButton,
				ToolBarButtonStyle.Separator, ToolBarButtonStyle.DropDownButton };
			int[] anImageIndex = { 0, 1, 2, 0, 4, 0, 3 };

			for (int i=0; i < astrTBB.Length; i++)
			{
				ToolBarButton tbb = new ToolBarButton();
				tbb.ImageIndex = anImageIndex[i];
				tbb.Style = atbbStyles[i];
				tbb.ToolTipText = astrTBB[i];
				if (tbb.Style == ToolBarButtonStyle.DropDownButton)
				{
					tbb.DropDownMenu = ddmDemo;
				}
				tbMain.Buttons.Add(tbb);
			}
		
		}
开发者ID:ppatoria,项目名称:SoftwareDevelopment,代码行数:28,代码来源:MAIN.CS

示例7: PtxToolButton

 public PtxToolButton(PtCommand cmd)
 {
     m_Command = cmd;
     m_Button = new ToolBarButton();
     m_Button.Text = m_Command.DisplayName;
     m_Command.AddObserver(this);
 }
开发者ID:JeffreyZksun,项目名称:opendraw,代码行数:7,代码来源:PtxToolButton.cs

示例8: Initialize

		public override void Initialize() {
			AutoScrollCanvas = true;
			windowSD = ScrollControl.ScrollDirector;
			documentSD = new DocumentScrollDirector();

			ToolBar toolBar = new ToolBar();
			ToolBarButton btnWindow = new ToolBarButton(WINDOW_LABEL);
			ToolBarButton btnDocument = new ToolBarButton(DOCUMENT_LABEL);
			toolBar.Buttons.Add(btnWindow);
			toolBar.Buttons.Add(btnDocument);
			toolBar.ButtonClick += new ToolBarButtonClickEventHandler(toolBar_ButtonClick);
			this.Controls.Add(toolBar);

			ScrollControl.Bounds = new Rectangle(ClientRectangle.X, toolBar.Bottom, ScrollControl.Width, ScrollControl.Height - toolBar.Height);

			// Make some rectangles on the surface so we can see where we are
			for (int x = 0; x < 20; x++) {
				for (int y = 0; y < 20; y++) {
					if (((x + y) % 2) == 0) {
						PPath path = PPath.CreateRectangle(50 * x, 50 * y, 40, 40);
						path.Brush = Brushes.Blue;
						path.Pen = Pens.Black;
						Canvas.Layer.AddChild(path);
					}
					else if (((x + y) % 2) == 1) {
						PPath path = PPath.CreateEllipse(50 * x, 50 * y, 40, 40);
						path.Brush = Brushes.Blue;
						path.Pen = Pens.Black;
						Canvas.Layer.AddChild(path);
					}
				}
			}
		}
开发者ID:malacandrian,项目名称:Piccolo.NET,代码行数:33,代码来源:ScrollingExample.cs

示例9: Form1

        public Form1()
        {
            InitializeComponent();
            list = new ImageList();
            list.ImageSize = new Size(50, 50);
            list.Images.Add(new Bitmap("open.bmp"));
            list.Images.Add(new Bitmap("save.bmp"));
            list.Images.Add(new Bitmap("exit.bmp"));

            tBar = new ToolBar();
                        
            tBar.ImageList = list; //привяжем список картинок к тулбару
            ToolBarButton toolBarButton1 = new ToolBarButton();
            ToolBarButton toolBarButton2 = new ToolBarButton();
            ToolBarButton toolBarButton3 = new ToolBarButton();
            ToolBarButton separator = new ToolBarButton();
            separator.Style = ToolBarButtonStyle.Separator;

            toolBarButton1.ImageIndex = 0; //Open
            toolBarButton2.ImageIndex = 1;// save
            toolBarButton3.ImageIndex = 2; //exit

            tBar.Buttons.Add(toolBarButton1);
            tBar.Buttons.Add(separator);
            tBar.Buttons.Add(toolBarButton2);
            tBar.Buttons.Add(separator);
            tBar.Buttons.Add(toolBarButton3);

            tBar.Appearance = ToolBarAppearance.Flat;
            tBar.BorderStyle = BorderStyle.Fixed3D;
            tBar.ButtonClick += new ToolBarButtonClickEventHandler(tBar_ButtonClick); 
            
            this.Controls.Add(tBar);
            
        }
开发者ID:xs2ranjeet,项目名称:13ns9-1spr,代码行数:35,代码来源:Form1.cs

示例10: Install

  { public static void Install (Panel ParentArg)
    { T_New New = new T_New (0) ;
      T_Open Open = new T_Open (1) ;
      T_Save Save = new T_Save (2) ;
      T_SaveAll SaveAll = new T_SaveAll (3) ;
      T_Close Close = new T_Close (4) ;
      T_Cut Cut = new T_Cut (5) ;
      T_Copy Copy = new T_Copy (6) ;
      T_Paste Paste = new T_Paste (7) ;
      T_Undo Undo = new T_Undo (8) ;
      T_ColorHighlighter ColorHighlighter = new T_ColorHighlighter (9) ;
      T_Search Search = new T_Search (10) ;
      T_Print Print = new T_Print (11) ;

      ToolBarButton Spacer = new ToolBarButton () ;
      Spacer.Style = ToolBarButtonStyle.Separator ;

      ImageList List = new ImageList () ;

      List.Images.Add (New.GetBMP()) ;
      List.Images.Add (Open.GetBMP()) ;
      List.Images.Add (Save.GetBMP()) ;
      List.Images.Add (SaveAll.GetBMP()) ;
      List.Images.Add (Close.GetBMP()) ;
      List.Images.Add (Cut.GetBMP()) ;
      List.Images.Add (Copy.GetBMP()) ;
      List.Images.Add (Paste.GetBMP()) ;
      List.Images.Add (Undo.GetBMP()) ;
      List.Images.Add (ColorHighlighter.GetBMP()) ;
      List.Images.Add (Search.GetBMP()) ;
      List.Images.Add (Print.GetBMP()) ;

      ToolBar Bar = new ToolBar () ;

      Bar.Parent = ParentArg ;
      Bar.ImageList = List ;
      Bar.ShowToolTips = true ;
      Bar.ButtonClick += new ToolBarButtonClickEventHandler (BarClick) ;

      Bar.Buttons.Add (New) ; 
      Bar.Buttons.Add (Open) ; 
      Bar.Buttons.Add (Save) ; 
      Bar.Buttons.Add (SaveAll) ; 
      Bar.Buttons.Add (Close) ;
 
      Bar.Buttons.Add (Spacer) ;
 
      Bar.Buttons.Add (Cut) ; 
      Bar.Buttons.Add (Copy) ; 
      Bar.Buttons.Add (Paste) ; 

      Bar.Buttons.Add (Spacer) ;
 
      Bar.Buttons.Add (Undo) ; 
      Bar.Buttons.Add (ColorHighlighter) ; 
      Bar.Buttons.Add (Search) ; 
      Bar.Buttons.Add (Print) ; 
    }
开发者ID:kcb146,项目名称:editor,代码行数:58,代码来源:ToolBar_Manager.CS

示例11: InitializeComponent

    /// <summary> 
    /// Required method for Designer support - do not modify 
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent() {
      this.components = new System.ComponentModel.Container();
      System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof (ListToolBarControl));
      this.toolBar = new System.Windows.Forms.ToolBar();
      this.tbtnPasteList = new System.Windows.Forms.ToolBarButton();
      this.tbtnSeparator = new System.Windows.Forms.ToolBarButton();
      this.imageList = new System.Windows.Forms.ImageList(this.components);
      this.tbtnAppendList = new System.Windows.Forms.ToolBarButton();
      this.SuspendLayout();
      // 
      // toolBar
      // 
      this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[]{
        this.tbtnPasteList,
        this.tbtnAppendList,
        this.tbtnSeparator
      });
      this.toolBar.DropDownArrows = true;
      this.toolBar.ImageList = this.imageList;
      this.toolBar.Location = new System.Drawing.Point(0, 0);
      this.toolBar.Name = "toolBar";
      this.toolBar.ShowToolTips = true;
      this.toolBar.Size = new System.Drawing.Size(64, 30);
      this.toolBar.TabIndex = 0;
      this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick);
      // 
      // tbtnPasteList
      // 
      this.tbtnPasteList.ImageIndex = 0;
      this.tbtnPasteList.Tag = "PasteList";
      this.tbtnPasteList.ToolTipText = "Paste list";
      // 
      // tbtnSeparator
      // 
      this.tbtnSeparator.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
      // 
      // imageList
      // 
      this.imageList.ImageSize = new System.Drawing.Size(19, 18);
      this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream")));
      this.imageList.TransparentColor = System.Drawing.Color.Transparent;
      // 
      // tbtnAppendList
      // 
      this.tbtnAppendList.ImageIndex = 1;
      this.tbtnAppendList.Tag = "AppendList";
      this.tbtnAppendList.ToolTipText = "Append list";
      // 
      // ListToolBarControl
      // 
      this.Controls.Add(this.toolBar);
      this.Name = "ListToolBarControl";
      this.Size = new System.Drawing.Size(64, 32);
      this.ResumeLayout(false);

    }
开发者ID:satr,项目名称:regexexplorer,代码行数:60,代码来源:ListToolBarControl.cs

示例12: Text

		public void Text ()
		{
			ToolBarButton tbb = new ToolBarButton ();
			Assert.AreEqual ("", tbb.Text, "A1");

			tbb.Text = "hi there";
			Assert.AreEqual ("hi there", tbb.Text, "A2");

			tbb.Text = null;
			Assert.AreEqual ("", tbb.Text, "A3");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:11,代码来源:ToolBarButtonTest.cs

示例13: Name

		public void Name ()
		{
			ToolBarButton tbb = new ToolBarButton ();
			Assert.AreEqual ("", tbb.Name, "A1");
			tbb.Name = "abc";
			Assert.AreEqual ("abc", tbb.Name, "A2");
			tbb.Name = "";
			Assert.AreEqual ("", tbb.Name, "A3");
			tbb.Name = null;
			Assert.AreEqual ("", tbb.Name, "A4");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:11,代码来源:ToolBarButtonTest.cs

示例14: Init

        public void Init()
        {
            var resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));

            this.Name = "toolbar";
            this.ImageList = new ImageList();
            this.ImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("defaultImage.ImageStream")));
            this.Appearance = ToolBarAppearance.Flat;

            this.EditState = initEditStateButton("editstate");
            this.AppSettings = initAppSettingsButton("appsettings");
            this.Save = initSaveButton("save");
            this.SaveAs = initSaveAsButton("saveAs");
            this.Open = initOpenButton("open");
            this.QuadTree = initQuadTreeButton("quadtree");

            this.Buttons.Add(EditState);
            this.Buttons.Add(AppSettings);
            this.Buttons.Add(initSeperator("seperator1"));
            this.Buttons.Add(Save);
            this.Buttons.Add(SaveAs);
            this.Buttons.Add(Open);
            this.Buttons.Add(initSeperator("seperator2"));
            this.Buttons.Add(QuadTree);

            this.ButtonClick += (object sender, ToolBarButtonClickEventArgs e) =>
            {
                if (e.Button.Name == "editstate")
                {
                    this.buttonEditStateHandleClick(sender, e);
                }
                else if (e.Button.Name == "appsettings")
                {
                    this.buttonAppSettingsHandleClick(sender, e);
                }
                else if (e.Button.Name == "save")
                {
                    this.buttonSaveHandleClick(sender, e);
                }
                else if (e.Button.Name == "saveAs")
                {
                    this.buttonSaveAsHandleClick(sender, e);
                }
                else if (e.Button.Name == "open")
                {
                    this.buttonOpenHandleClick(sender, e);
                }
                else if (e.Button.Name == "quadtree")
                {
                    this.buttonQuadtreeHandleClick(sender, e);
                }
            };
        }
开发者ID:7ung,项目名称:NMGAME,代码行数:53,代码来源:METoolbar.cs

示例15: InitializeComponent

 private void InitializeComponent() {
     this.components = new Container();
     ResourceManager resources = new ResourceManager(typeof (ScalerToolBarControl));
     this.toolBar = new ToolBar();
     this.tbtnScaleUp = new ToolBarButton();
     this.tbtnScaleDown = new ToolBarButton();
     this.imageList = new ImageList(this.components);
     this.SuspendLayout();
     // 
     // toolBar
     // 
     this.toolBar.Buttons.AddRange(new ToolBarButton[] {
                                                           this.tbtnScaleUp,
                                                           this.tbtnScaleDown
                                                       });
     this.toolBar.DropDownArrows = true;
     this.toolBar.ImageList = this.imageList;
     this.toolBar.Location = new Point(0, 0);
     this.toolBar.Name = "toolBar";
     this.toolBar.ShowToolTips = true;
     this.toolBar.Size = new Size(56, 30);
     this.toolBar.TabIndex = 0;
     this.toolBar.ButtonClick += new ToolBarButtonClickEventHandler(this.toolBar_ButtonClick);
     // 
     // tbtnScaleUp
     // 
     this.tbtnScaleUp.ImageIndex = 0;
     this.tbtnScaleUp.Tag = "ScaleUp";
     this.tbtnScaleUp.ToolTipText = "Scale up";
     // 
     // tbtnScaleDown
     // 
     this.tbtnScaleDown.ImageIndex = 1;
     this.tbtnScaleDown.Tag = "ScaleDown";
     this.tbtnScaleDown.ToolTipText = "Scale down";
     // 
     // imageList
     // 
     this.imageList.ImageSize = new Size(19, 18);
     this.imageList.ImageStream = ((ImageListStreamer) (resources.GetObject("imageList.ImageStream")));
     this.imageList.TransparentColor = Color.Transparent;
     // 
     // ScalerToolBarControl
     // 
     this.Controls.Add(this.toolBar);
     this.Name = "ScalerToolBarControl";
     this.Size = new Size(56, 32);
     this.ResumeLayout(false);
 }
开发者ID:satr,项目名称:regexexplorer,代码行数:49,代码来源:ScalerToolBarControl.cs


注:本文中的System.Windows.Forms.ToolBarButton类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。