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


C# TabControl类代码示例

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


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

示例1: InstructionsForm

	public InstructionsForm ()
	{
		// 
		// _tabControl
		// 
		_tabControl = new TabControl ();
		_tabControl.Dock = DockStyle.Fill;
		Controls.Add (_tabControl);
		// 
		// _bugDescriptionText1
		// 
		_bugDescriptionText1 = new TextBox ();
		_bugDescriptionText1.Multiline = true;
		_bugDescriptionText1.Location = new Point (8, 8);
		_bugDescriptionText1.Dock = DockStyle.Fill;
		_bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture,
			"Expected result on start-up:{0}{0}" +
			"1. The background color of the Form is blue and does not show " +
			"any distortions.",
			Environment.NewLine);
		// 
		// _tabPage1
		// 
		_tabPage1 = new TabPage ();
		_tabPage1.Text = "#1";
		_tabPage1.Controls.Add (_bugDescriptionText1);
		_tabControl.Controls.Add (_tabPage1);
		// 
		// InstructionsForm
		// 
		ClientSize = new Size (330, 120);
		Location = new Point (600, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "Instructions - bug #81721";
	}
开发者ID:mono,项目名称:gert,代码行数:35,代码来源:MainForm.cs

示例2: AddPage

    public static void AddPage(TabControl tabControl, string tapName, Page page, bool maxSize = true)
    {
        if (maxSize)
        {
            page.Width = double.NaN;
            page.Height = double.NaN;
            page.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            page.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
        }

        Frame frame = new Frame();
        if (maxSize)
        {
            frame.Width = double.NaN;
            frame.Height = double.NaN;
            frame.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            frame.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
        }

        frame.Content = page;
        TabItem tabItem = new TabItem();
        tabItem.Header = tapName;
        tabItem.Content = frame;
        tabControl.Items.Add(tabItem);
    }
开发者ID:vesteksoftware,项目名称:VT8642,代码行数:25,代码来源:UIUtility.cs

示例3: Update

        private void Update()
        {
            if (Views.Count == 0) Content = null;
            else
            {
                if(Views.Count == 1)
                {
                    var viewKey = Views.Keys.First();
                    Content = Views[viewKey];
                }
                if(Views.Count > 1)
                {
                    var tabControl = new TabControl();
                    foreach(var key in Views.Keys)
                    {
                        var view = Views[key];
                        tabControl.Items.Add(new TabItem { Header = key.ToString(), Content = view });
                    }
                    Content = tabControl;
                }
            }

            foreach(var key in Views.Keys)
            {
                Views[key].DataContext = DataContext;
            }
        }
开发者ID:node-net,项目名称:Node.Net,代码行数:27,代码来源:ViewFrame.cs

示例4: AddPages

    public static void AddPages(TabControl tabControl, string tabName, bool maxSize, params Page[] pages)
    {
        Grid grid = new Grid();
        grid.Width = double.NaN;
        grid.Height = double.NaN;
        grid.Margin = new Thickness(0);
        grid.VerticalAlignment = VerticalAlignment.Top;

        if (maxSize)
        {
            grid.HorizontalAlignment = HorizontalAlignment.Stretch;
            grid.VerticalAlignment = VerticalAlignment.Stretch;
        }

        int index = 0;
        foreach (var item in pages)
        {
            ColumnDefinition col = new ColumnDefinition();
            col.Width = GridLength.Auto;
            grid.ColumnDefinitions.Add(col);
            SetPageToGrid(item, grid, 0, index);
            index++;
        }

        TabItem tabItem = new TabItem();
        tabItem.Header = tabName;
        tabItem.Content = grid;
        tabControl.Items.Add(tabItem);
    }
开发者ID:vesteksoftware,项目名称:VT5025,代码行数:29,代码来源:UIUtility.cs

示例5: MainForm

	public MainForm ()
	{
		// 
		// _tabControl
		// 
		_tabControl = new TabControl ();
		_tabControl.Dock = DockStyle.Fill;
		Controls.Add (_tabControl);
		// 
		// _tabGeneral
		// 
		_tabGeneral = new TabPage ();
		_tabGeneral.TabIndex = 0;
		_tabGeneral.Text = "General";
		_tabControl.Controls.Add (_tabGeneral);
		// 
		// _tabAlerts
		// 
		_tabAlerts = new TabPage ();
		_tabAlerts.TabIndex = 1;
		_tabAlerts.Text = "Alerts";
		_tabControl.Controls.Add (_tabAlerts);
		// 
		// MainForm
		// 
		ClientSize = new Size (300, 100);
		Location = new Point (250, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #82229";
		Load += new EventHandler (MainForm_Load);
	}
开发者ID:mono,项目名称:gert,代码行数:31,代码来源:MainForm.cs

示例6: GuiTester

        public GuiTester()
        {
            mainNavigationTabControl = new TabControl(Orientation.Vertical);

            mainNavigationTabControl.AddTab(new MenuPage(), "MenuPage");
#if true
            mainNavigationTabControl.AddTab(new TextEditPage(), "TextEditPage");
            mainNavigationTabControl.AddTab(new SplitterPage(), "SplitterPage");
            mainNavigationTabControl.AddTab(new LayoutPage(), "LayoutPage");
            mainNavigationTabControl.AddTab(new ButtonsPage(), "ButtonsPage");

            mainNavigationTabControl.AddTab(new ScrollableWidgetTestPage(), "ScrollableWidgetTestPage");
            mainNavigationTabControl.AddTab(new AnchorCenterButtonsTestPAge(), "AnchorCenterButtonsTestPAge");
            mainNavigationTabControl.AddTab(new TabPagesPage(), "TabPagesPage");
            mainNavigationTabControl.AddTab(new ListBoxPage(), "ListBoxPage");
            mainNavigationTabControl.AddTab(new ButtonAnchorTestPage(), "ButtonAnchorTestPage");

            
            mainNavigationTabControl.AddTab(new AnchorTestsPage(), "AnchorTestsPage");
            mainNavigationTabControl.AddTab(new WindowPage(), "WindowPage");

            mainNavigationTabControl.AddTab(new SliderControlsPage(), "SliderControlsPage");
            mainNavigationTabControl.AddTab(new TabPage(new FontInfoWidget(), "Fonts"), "Fonts");
#endif
            this.AddChild(mainNavigationTabControl);

            AnchorAll();
        }
开发者ID:jeske,项目名称:agg-sharp,代码行数:28,代码来源:GUITester.cs

示例7: TabItemIsEnabledPropertyUpdateTest

        public void TabItemIsEnabledPropertyUpdateTest()
        {
            TabControl tabControl = new TabControl();

            TabItem tabItem1 = new TabItem();
            TabItem tabItem2 = new TabItem();

            tabControl.Items.Add(tabItem1);
            tabControl.Items.Add(tabItem2);

            CreateAsyncTask(tabControl,
                () => Assert.IsTrue(tabControl.IsEnabled),
                () => Assert.IsTrue(tabItem1.IsEnabled),
                () => Assert.IsTrue(tabItem2.IsEnabled),

                () => tabItem1.IsEnabled = false,
                () => tabControl.IsEnabled = false,
                () => Assert.IsFalse(tabItem1.IsEnabled),
                () => Assert.IsFalse(tabItem2.IsEnabled),

                () => tabControl.IsEnabled = true,
                () => Assert.IsFalse(tabItem1.IsEnabled),
                () => Assert.IsTrue(tabItem2.IsEnabled)
            );

            EnqueueTestComplete();
        }
开发者ID:dfr0,项目名称:moon,代码行数:27,代码来源:TabControlTest.cs

示例8: ChatWindow

        public ChatWindow()
        {
            Style = "window";
            Resizable = false;
            Size = new Point(512, 140);
            MinSize = new Point(512, 140);
            MaxSize = new Point(786, 512);

            handle = new Button {
                Size = new Point(16, 16),
                Position = new Point(512 - 16, 0),
                Style = "handleNE",
                Anchor = AnchorStyles.Top | AnchorStyles.Right,
                Cursor = Cursors.SizeNESW
            };
            handle.MouseDown += handle_OnMouseDown;
            handle.MousePress += handle_OnMousePress;
            Elements.Add(handle);

            input = new TextBox {Size = new Point(100, 35), Dock = DockStyle.Bottom};
            input.TextCommit += Input_OnTextCommit;
            input.Style = "textbox";
            input.Margin = new Margin(2);
            Controls.Add(input);

            tabs = new TabControl {Dock = DockStyle.Fill};
            tabs.ButtonFrame.Size = new Point(28, 28);
            Controls.Add(tabs);

            GeneralChat = AddPage("General");
            CombatChat = AddPage("Combat");
        }
开发者ID:ndssia,项目名称:Corsair3,代码行数:32,代码来源:ChatWindow.cs

示例9: First_Tab_Should_Be_Selected_By_Default

        public void First_Tab_Should_Be_Selected_By_Default()
        {
            TabItem selected;
            var target = new TabControl
            {
                Template = new FuncControlTemplate<TabControl>(CreateTabControlTemplate),
                Items = new[]
                {
                    (selected = new TabItem
                    {
                        Name = "first",
                        Content = "foo",
                    }),
                    new TabItem
                    {
                        Name = "second",
                        Content = "bar",
                    },
                }
            };

            target.ApplyTemplate();

            Assert.Equal(0, target.SelectedIndex);
            Assert.Equal(selected, target.SelectedItem);
        }
开发者ID:abdelkarim,项目名称:Perspex,代码行数:26,代码来源:TabControlTests.cs

示例10: PageLocomotiveProperties

        public PageLocomotiveProperties(Locomotive locomotive)
        {
            this.locomotive = locomotive;

            StackPanel panel = new StackPanel(Orientation.Vertical);
            Child = panel;

            tabs = new TabControl();
            tabs.AddTab(CreateTabCommon());
            tabs.AddTab(CreateTabFunctions());
            panel.Children.Add(tabs);

            StackPanel panelBottom = new StackPanel(Orientation.Horizontal);
            panelBottom.HorizontalAlignment = HorizontalAlignment.Center;
            panel.Children.Add(panelBottom);

            Button btnSave = new Button(Program.FontRegular, "Сохранить", Resources.GetBitmap(Resources.BitmapResources.Save), Program.ButtonTextColor);
            btnSave.SetMargin(2);
            btnSave.VerticalAlignment = VerticalAlignment.Bottom;
            btnSave.HorizontalAlignment = HorizontalAlignment.Center;
            btnSave.Background = Program.ButtonBackground;
            btnSave.Clicked += new EventHandler(btnSave_Clicked);
            panelBottom.Children.Add(btnSave);

            tabs.Height = panel.Parent.Height - btnSave.Height - 8;

            ucWriteBlock writeBlock = new ucWriteBlock();
            writeBlock.VerticalAlignment = VerticalAlignment.Bottom;
            writeBlock.HorizontalAlignment = HorizontalAlignment.Center;
            writeBlock.SetMargin(5, 0, 0, 0);
            writeBlock.WriteClicked += new EventHandler(writeBlock_WriteClicked);
            panelBottom.Children.Add(writeBlock);

            LoadValues();
        }
开发者ID:KonstantinKolesnik,项目名称:Typhoon,代码行数:35,代码来源:PageLocomotiveProperties.cs


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