• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Controls.ToolBar类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: AbstractConsolePad

		protected AbstractConsolePad()
		{
			this.panel = new Grid();
			
			this.console = new ConsoleControl();
			
			// creating the toolbar accesses the WordWrap property, so we must do this after creating the console
			this.toolbar = BuildToolBar();
			this.toolbar.SetValue(DockPanel.DockProperty, Dock.Top);
			
			panel.Children.Add(toolbar);
			panel.Children.Add(console);
			
			panel.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
			panel.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });

			Grid.SetRow(console, 1);
			
			this.history = new List<string>();
			
			this.console.editor.TextArea.PreviewKeyDown += (sender, e) => {
				e.Handled = HandleInput(e.Key);
			};
			
			this.console.editor.TextArea.TextEntered += AbstractConsolePadTextEntered;
			
			this.InitializeConsole();
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:28,代码来源:AbstractConsolePad.cs


示例2: AddFileToolBar

        void AddFileToolBar(ToolBarTray tray, int band, int index)
        {
            ToolBar toolbar = new ToolBar();
            toolbar.Band = band;
            toolbar.BandIndex = index;
            tray.ToolBars.Add(toolbar);

            RoutedUICommand[] comm = {
                ApplicationCommands.New, ApplicationCommands.Open, ApplicationCommands.Save
            };

            string[] strImages = {
                "NewDocumentHS.png", "OpenHS.png", "SaveHS.png"
            };

            for (int i = 0; i < 3; i++)
            {
                Button btn = new Button();
                btn.Command = comm[i];
                toolbar.Items.Add(btn);
                string fileName = Path.Combine(Directory.GetCurrentDirectory(), strImages[i]);
                Image img = new Image();
                img.Source = new BitmapImage(new Uri(fileName));
                img.Stretch = Stretch.None;
                btn.Content = img;

                ToolTip tip = new ToolTip();
                tip.Content = comm[i].Text;
                btn.ToolTip = tip;
            }

            CommandBindings.Add(new CommandBinding(ApplicationCommands.New, OnNew));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Open, OnOpen));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Save, OnSave));
        }
开发者ID:JianchengZh,项目名称:kasicass,代码行数:35,代码来源:FormatRichText.File.cs


示例3: TryArrangeChildren

        private void TryArrangeChildren(IList<Region> children)
        {
            if (children.Count > 0)
            {
                var toolBar = new ToolBar();
                toolBarContainer.Content = toolBar;
                toolBarContainer.Visibility = Visibility.Visible;

                for (int i = 0, c = children.Count; i < c; i++)
                {
                    var child = children[i];

                    var btn = new Button()
                    {
                        Content = child.ChildrenLabel
                    };

                    btn.Click += (o, e) =>
                    {
                        var control = child.ControlResult.Control;
                        control.RemoveFromParent();
                        new Window()
                        {
                            WindowState = WindowState.Maximized,
                            Content = control
                        }.Show();
                    };

                    toolBar.Items.Add(btn);
                }
            }
        }
开发者ID:569550384,项目名称:Rafy,代码行数:32,代码来源:ListDetailPopupChildrenLayout.xaml.cs


示例4: ErrorListPad

        public ErrorListPad()
        {
            instance = this;
            properties = PropertyService.NestedProperties("ErrorListPad");

            TaskService.Cleared += TaskServiceCleared;
            TaskService.Added   += TaskServiceAdded;
            TaskService.Removed += TaskServiceRemoved;
            TaskService.InUpdateChanged += delegate {
                if (!TaskService.InUpdate)
                    InternalShowResults();
            };

            SD.BuildService.BuildFinished += ProjectServiceEndBuild;
            SD.ProjectService.SolutionOpened += OnSolutionOpen;
            SD.ProjectService.SolutionClosed += OnSolutionClosed;
            errors = new ObservableCollection<SDTask>(TaskService.Tasks.Where(t => t.TaskType != TaskType.Comment));

            toolBar = ToolBarService.CreateToolBar(contentPanel, this, "/SharpDevelop/Pads/ErrorList/Toolbar");

            contentPanel.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
            contentPanel.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
            contentPanel.Children.Add(toolBar);
            contentPanel.Children.Add(errorView);
            Grid.SetRow(errorView, 1);
            errorView.ItemsSource = errors;
            errorView.MouseDoubleClick += ErrorViewMouseDoubleClick;
            errorView.Style = (Style)new TaskViewResources()["TaskListView"];
            errorView.ContextMenu = MenuService.CreateContextMenu(errorView, DefaultContextMenuAddInTreeEntry);

            errorView.CommandBindings.Add(new CommandBinding(ApplicationCommands.Copy, ExecuteCopy, CanExecuteCopy));
            errorView.CommandBindings.Add(new CommandBinding(ApplicationCommands.SelectAll, ExecuteSelectAll, CanExecuteSelectAll));

            InternalShowResults();
        }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:35,代码来源:ErrorListPad.cs


示例5: AddToolBar

 private void AddToolBar(IMenu toolbarModel)
 {
     var toolBar = new ToolBar();
     toolBar.SetResourceReference(ToolBar.StyleProperty, Resources.ToolBarStyleKey);
     toolBar.DataContext = toolbarModel;
     m_toolBarTray.ToolBars.Add(toolBar);
 }
开发者ID:vincenthamm,项目名称:ATF,代码行数:7,代码来源:ToolBarTrayBinder.cs


示例6: RemoveToolBarOverflow

 public static void RemoveToolBarOverflow(ToolBar toolBar)
 {
     FrameworkElement overflowGrid = toolBar.Template.FindName("OverflowGrid", toolBar) as FrameworkElement;
     if (overflowGrid != null)
     {
         overflowGrid.Visibility = Visibility.Collapsed;
     }
 }
开发者ID:JaakkoLipsanen,项目名称:Flai.XNA,代码行数:8,代码来源:WpfHelper.cs


示例7: AddSeparator

 public void AddSeparator(double width,ToolBar location)
 {
     Separator sp = new Separator();
     sp.Width = width;
     BrushConverter bc = new BrushConverter();
     sp.Background = (Brush)bc.ConvertFrom("Transparent");
     location.Items.Add(sp);
 }
开发者ID:SAM33,项目名称:2016-OOP-UMLEditor,代码行数:8,代码来源:ToolsPanel.xaml.cs


示例8: ResizeToolbar

        public static void ResizeToolbar(ToolBar toolStrip, FrameworkElement resizingItem)
        {
            var w = (from FrameworkElement t in toolStrip.Items where t != resizingItem select t.ActualWidth).Sum();

            if (((toolStrip.ActualWidth - w) - 50) > 50)
                resizingItem.Width = (toolStrip.ActualWidth - w) - 50;
            else
                resizingItem.Width = 50;
        }
开发者ID:betology,项目名称:SambaPOS-3,代码行数:9,代码来源:BrowserControl.xaml.cs


示例9: CraftTheToolbar

        public CraftTheToolbar()
        {
            Title = "Craft the Toolbar";

            RoutedUICommand[] comm =
                {
                    ApplicationCommands.New, ApplicationCommands.Open,
                    ApplicationCommands.Save, ApplicationCommands.Print,
                    ApplicationCommands.Cut, ApplicationCommands.Copy,
                    ApplicationCommands.Paste, ApplicationCommands.Delete
                };

            string[] strImages =
                {
                    "NewDocumentHS.png", "openHS.png", "saveHS.png",
                    "PrintHS.png", "CutHS.png", "CopyHS.png",
                    "PasteHS.png", "DeleteHS.png"
                };

            // Create DockPanel as content of window.
            DockPanel dock = new DockPanel();
            dock.LastChildFill = false;
            Content = dock;

            // Create Toolbar docked at top of window.
            ToolBar toolbar = new ToolBar();
            dock.Children.Add(toolbar);
            DockPanel.SetDock(toolbar, Dock.Top);

            // Create the Toolbar buttons.
            for (int i = 0; i < 8; i++)
            {
                if (i == 4)
                    toolbar.Items.Add(new Separator());

                // Create the Button.
                Button btn = new Button();
                btn.Command = comm[i];
                toolbar.Items.Add(btn);

                // Create an Image as content of the Button.
                Image img = new Image();
                img.Source = new BitmapImage(
                    new Uri("pack://application:,,/Images/" + strImages[i]));
                img.Stretch = Stretch.None;
                btn.Content = img;

                // Create a ToolTip based on the UICommand text.
                ToolTip tip = new ToolTip();
                tip.Content = comm[i].Text;
                btn.ToolTip = tip;

                // Add the UICommand to the window command bindings.
                CommandBindings.Add(
                    new CommandBinding(comm[i], ToolBarButtonOnClick));
            }
        }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:57,代码来源:CraftTheToolbar.cs


示例10: AddTool

 //Add new tool to toolsbox
 public void AddTool(BaseUMLMode Mode, Uri icon1, Uri icon2, ToolBar location)
 {
     ToolButton UIButton = new Controls.ToolButton(Mode, icon1, icon2);
     UIButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(ToolsButton_MouseLeftButtonDown), true);
     UIButton.AddHandler(MouseEnterEvent, new MouseEventHandler(ToolsButton_MouseEnter), true);
     UIButton.AddHandler(MouseLeaveEvent, new MouseEventHandler(ToolsPanel_MouseEnter), true);
     location.Items.Add(UIButton);
     Buttons.Add(UIButton);
 }
开发者ID:SAM33,项目名称:2016-OOP-UMLEditor,代码行数:10,代码来源:ToolsPanel.xaml.cs


示例11: switch

 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.toolBar1 = ((System.Windows.Controls.ToolBar)(target));
     return;
     }
     this._contentLoaded = true;
 }
开发者ID:JamesFason,项目名称:PlaylistSplicer,代码行数:9,代码来源:MainWindow.g.i.cs


示例12: MeetTheDockers

        public MeetTheDockers()
        {
            Title = "Meet the Dockers";

            DockPanel dock = new DockPanel();
            Content = dock;

            // Create menu.
            Menu menu = new Menu();
            MenuItem item = new MenuItem();
            item.Header = "Menu";
            menu.Items.Add(item);

            // Dock menu at top of panel.
            DockPanel.SetDock(menu, Dock.Top);
            dock.Children.Add(menu);

            // Create tool bar.
            ToolBar tool = new ToolBar();
            tool.Header = "Toolbar";

            // Dock tool bar at top of panel.
            DockPanel.SetDock(tool, Dock.Top);
            dock.Children.Add(tool);

            // Create status bar.
            StatusBar status = new StatusBar();
            StatusBarItem statitem = new StatusBarItem();
            statitem.Content = "Status";
            status.Items.Add(statitem);

            // Dock status bar at bottom of panel.
            DockPanel.SetDock(status, Dock.Bottom);
            dock.Children.Add(status);

            // Create list box.
            ListBox lstbox = new ListBox();
            lstbox.Items.Add("List Box Item");

            // Dock list box at left of panel.
            DockPanel.SetDock(lstbox, Dock.Left);
            dock.Children.Add(lstbox);

            // Create text box.
            TextBox txtbox = new TextBox();
            txtbox.AcceptsReturn = true;

            // Add text box to panel & give it input focus.
            dock.Children.Add(txtbox);
            txtbox.Focus();
        }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:51,代码来源:MeetTheDockers.cs


示例13: AddEditToolBar

        void AddEditToolBar(ToolBarTray tray, int band, int index)
        {
            // Create Toolbar.
            ToolBar toolbar = new ToolBar();
            toolbar.Band = band;
            toolbar.BandIndex = index;
            tray.ToolBars.Add(toolbar);

            RoutedUICommand[] comm =
                {
                    ApplicationCommands.Cut, ApplicationCommands.Copy,
                    ApplicationCommands.Paste, ApplicationCommands.Delete,
                    ApplicationCommands.Undo, ApplicationCommands.Redo
                };

            string[] strImages =
                {
                    "CutHS.png", "CopyHS.png",
                    "PasteHS.png", "DeleteHS.png",
                    "Edit_UndoHS.png", "Edit_RedoHS.png"
                };

            for (int i = 0; i < 6; i++)
            {
                if (i == 4)
                    toolbar.Items.Add(new Separator());

                Button btn = new Button();
                btn.Command = comm[i];
                toolbar.Items.Add(btn);

                Image img = new Image();
                img.Source = new BitmapImage(
                        new Uri("pack://application:,,/Images/" + strImages[i]));
                img.Stretch = Stretch.None;
                btn.Content = img;

                ToolTip tip = new ToolTip();
                tip.Content = comm[i].Text;
                btn.ToolTip = tip;
            }

            CommandBindings.Add(new CommandBinding(ApplicationCommands.Cut));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Copy));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Paste));
            CommandBindings.Add(new CommandBinding(
                            ApplicationCommands.Delete, OnDelete, CanDelete));

            CommandBindings.Add(new CommandBinding(ApplicationCommands.Undo));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Redo));
        }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:51,代码来源:FormatRichText.Edit.cs


示例14: CraftTheToolbar

        public CraftTheToolbar()
        {
            Title = "Craft the Toolbar";

            RoutedUICommand[] comm = {
                ApplicationCommands.New,
                ApplicationCommands.Open,
                ApplicationCommands.Save,
                ApplicationCommands.Print,
                ApplicationCommands.Cut,
                ApplicationCommands.Copy,
                ApplicationCommands.Paste,
                ApplicationCommands.Delete
            };

            string[] strImages = {
                "NewDocumentHS.png", "OpenHS.png", "SaveHS.png", "PrintHS.png",
                "CutHS.png", "CopyHS.png", "PasteHS.png", "DeleteHS.png"
            };

            DockPanel dock = new DockPanel();
            dock.LastChildFill = false;
            Content = dock;

            ToolBar toolbar = new ToolBar();
            dock.Children.Add(toolbar);
            DockPanel.SetDock(toolbar, Dock.Top);

            for (int i = 0; i < 8; i++)
            {
                if (i == 4)
                    toolbar.Items.Add(new Separator());

                Button btn = new Button();
                btn.Command = comm[i];
                toolbar.Items.Add(btn);

                Image img = new Image();
                string fileName = Path.Combine(Directory.GetCurrentDirectory(), strImages[i]);
                img.Source = new BitmapImage(new Uri(fileName));
                img.Stretch = Stretch.None;
                btn.Content = img;

                ToolTip tip = new ToolTip();
                tip.Content = comm[i].Text;
                btn.ToolTip = tip;

                CommandBindings.Add(new CommandBinding(comm[i], ToolBarButtonOnClick));
            }
        }
开发者ID:JianchengZh,项目名称:kasicass,代码行数:50,代码来源:CraftTheToolbar.cs


示例15: AddParaToolBar

        void AddParaToolBar(ToolBarTray tray, int band, int index)
        {
            ToolBar toolbar = new ToolBar();
            toolbar.Band = band;
            toolbar.BandIndex = index;
            tray.ToolBars.Add(toolbar);

            toolbar.Items.Add(btnAlignment[0] = CreateButton(TextAlignment.Left, "Align Left", 0, 4));
            toolbar.Items.Add(btnAlignment[1] = CreateButton(TextAlignment.Center, "Center", 2, 2));
            toolbar.Items.Add(btnAlignment[2] = CreateButton(TextAlignment.Right, "Align Right", 4, 0));
            toolbar.Items.Add(btnAlignment[3] = CreateButton(TextAlignment.Justify, "Justify", 0, 0));

            txtbox.SelectionChanged += TextBoxOnSelectionChanged2;
        }
开发者ID:JianchengZh,项目名称:kasicass,代码行数:14,代码来源:FormatRichText.Param.cs


示例16: DebuggerPad

        /// <summary>
        /// Default cto
        /// </summary>
        protected DebuggerPad()
        {
            // UI
            this.panel = new DockPanel();
            this.toolbar = BuildToolBar();

            if (this.toolbar != null) {
                this.toolbar.SetValue(DockPanel.DockProperty, Dock.Top);

                this.panel.Children.Add(toolbar);
            }

            InitializeComponents();
            AttachToDebugger();
        }
开发者ID:Xtremrules,项目名称:dot42,代码行数:18,代码来源:DebuggerPad.cs


示例17: AddFileToolBar

        void AddFileToolBar(ToolBarTray tray, int band, int index)
        {
            // Create the ToolBar.
            ToolBar toolbar = new ToolBar();
            toolbar.Band = band;
            toolbar.BandIndex = index;
            tray.ToolBars.Add(toolbar);

            RoutedUICommand[] comm =
                {
                    ApplicationCommands.New, ApplicationCommands.Open,
                    ApplicationCommands.Save
                };

            string[] strImages =
                {
                    "NewDocumentHS.png", "openHS.png", "saveHS.png"
                };

            // Create buttons for the ToolBar.
            for (int i = 0; i < 3; i++)
            {
                Button btn = new Button();
                btn.Command = comm[i];
                toolbar.Items.Add(btn);

                Image img = new Image();
                img.Source = new BitmapImage(
                        new Uri("pack://application:,,/Images/" + strImages[i]));
                img.Stretch = Stretch.None;
                btn.Content = img;

                ToolTip tip = new ToolTip();
                tip.Content = comm[i].Text;
                btn.ToolTip = tip;
            }

            // Add the command bindings.
            CommandBindings.Add(
                new CommandBinding(ApplicationCommands.New, OnNew));
            CommandBindings.Add(
                new CommandBinding(ApplicationCommands.Open, OnOpen));
            CommandBindings.Add(
                new CommandBinding(ApplicationCommands.Save, OnSave));
        }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:45,代码来源:FormatRichText.File.cs


示例18: CreateMenuEndItem

 protected void CreateMenuEndItem(PluginMenuItemPart firstPart, ToolBar theMenuItem, Image theImageList)
 {
     if (firstPart.TextStyle.ButtonType == null)
     {
         theMenuItem.Header = firstPart.TextStyle.Text;
         theMenuItem.ToolTip = firstPart.TextStyle.ToolTipText;
         if (firstPart.TextStyle.Image != null)
         {
             try
             {
                 string image = firstPart.TextStyle.Image;
                 LoadImage(theImageList, image);
                 //theMenuItem.ImageKey = image;
             }
             catch { }
         }
     }
     else
     {
         theMenuItem = ReflectUtils.CreateInstance(firstPart.TextStyle.ButtonType)
         as ToolBar;
         theMenuItem.Header = firstPart.TextStyle.Text;
         theMenuItem.ToolTip = firstPart.TextStyle.ToolTipText;
         if (firstPart.TextStyle.Image != null)
         {
             try
             {
                 string image = firstPart.TextStyle.Image;
                 LoadImage(theImageList, image);
                 //theMenuItem.ImageKey = image;
             }
             catch { }
         }
         if (firstPart.TextStyle.Tag != null)
         {
             try
             {
                 //theMenuItem.Alignment = (ToolStripItemAlignment)(Enum.Parse(
                 //    typeof(ToolStripItemAlignment), firstPart.TextStyle.Tag.Split(',')[0], true
                 //    ));
             }
             catch { }
         }
     }
 }
开发者ID:nateliu,项目名称:StarSharp,代码行数:45,代码来源:PluginMenuToolbarBuilder.cs


示例19: SearchResultsPad

		public SearchResultsPad()
		{
			if (instance != null)
				throw new InvalidOperationException("Cannot create multiple instances");
			instance = this;
			toolBar = new ToolBar();
			ToolBarTray.SetIsLocked(toolBar, true);
			defaultToolbarItems = ToolBarService.CreateToolBarItems(dockPanel, this, "/SharpDevelop/Pads/SearchResultPad/Toolbar");
			foreach (object toolBarItem in defaultToolbarItems) {
				toolBar.Items.Add(toolBarItem);
			}
			
			DockPanel.SetDock(toolBar, Dock.Top);
			contentPlaceholder = new ContentPresenter();
			dockPanel = new DockPanel {
				Children = { toolBar, contentPlaceholder }
			};
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:18,代码来源:SearchResultsPad.cs


示例20: UnitTestsPad

		public UnitTestsPad(ITestService testService)
		{
			this.testService = testService;
			
			panel = new DockPanel();
			treeView = new TestTreeView(); // treeView must be created first because it's used by CreateToolBar

			toolBar = CreateToolBar("/SharpDevelop/Pads/UnitTestsPad/Toolbar");
			panel.Children.Add(toolBar);
			DockPanel.SetDock(toolBar, Dock.Top);
			
			panel.Children.Add(treeView);
			
			treeView.ContextMenu = CreateContextMenu("/SharpDevelop/Pads/UnitTestsPad/ContextMenu");
			
			testService.OpenSolutionChanged += testService_OpenSolutionChanged;
			testService_OpenSolutionChanged(null, null);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:18,代码来源:UnitTestsPad.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Controls.ToolTip类代码示例发布时间:2022-05-26
下一篇:
C# Controls.TextChangedEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap