博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
wpf TabControl控件的用法
阅读量:4674 次
发布时间:2019-06-09

本文共 1340 字,大约阅读时间需要 4 分钟。

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Shapes;namespace wpf控件互相绑定{    ///     /// Window2.xaml 的交互逻辑    ///     public partial class Window2 : Window    {        public Window2()        {            InitializeComponent();        }        //当点击打开的时候        int i = 0;        TabItem tab;        TextBox tb;        DataGrid dg;              private void MenuItem_Click_1(object sender, RoutedEventArgs e)        {           tab=new TabItem();  //造选项卡           tab.Header = "新窗口" + (i+1);  //新选项卡的名字           TabControl1.Items.Add(tab);  //选项卡集合           TabControl1.SelectedIndex = i;           tb = new TextBox();           tb.Width = 200;           tb.Height = 200;                   if (i==0)           {                 tab.Content = tb;           }           tab.MouseDoubleClick += tab_MouseDoubleClick;//双击关闭选项卡           i++;          }        private void tab_MouseDoubleClick(object sender, MouseButtonEventArgs e)        {            TabItem s = (TabItem)sender;            TabControl1.Items.Remove(s);        }

 

转载于:https://www.cnblogs.com/275147378abc/p/4613062.html

你可能感兴趣的文章
Java Socket编程----通信是这样炼成的
查看>>
作业要求 20180925-1 每周例行报告
查看>>
1078. Hashing (25)-PAT甲级真题
查看>>
SQLite中的运算符表达式
查看>>
Grid使用 & ComboBox Binding & DateTime Format WPF
查看>>
.Net Core迁移到MSBuild的多平台编译问题
查看>>
数据结构之删除线性表中的元素
查看>>
redis安装配置
查看>>
结对项目博客
查看>>
讨论记录:求大于一个时间段的最大平均积分,O(n)时间实现
查看>>
error) DENIED Redis is running in protected mode because protected mode is enabled报错
查看>>
CSS-16-margin值重叠问题
查看>>
selenium常用方法
查看>>
第二次作业
查看>>
ios 面试题
查看>>
express细节点注意
查看>>
MySQL教程(二)—— 关于在ACCESS中使用SQL语句
查看>>
实验4.1
查看>>
接口Interface
查看>>
bzoj 1651: [Usaco2006 Feb]Stall Reservations 专用牛棚【贪心+堆||差分】
查看>>