首页 新闻 搜索 专区 学院

windows form中datagrid显示不出表头,求救

0
[已关闭问题] 关闭于 2012-10-19 14:01

如题,

 private DataGridTableStyle BuildDataGridTableStylePC()
        {
            DataGridTableStyle ts = new DataGridTableStyle();
            ts.MappingName = "PrinterClient";
            dataGridExPrinter.SingleSelection = true;
            dataGridExPrinter.AllowNavigation = false;

            ts.RowHeaderWidth = 1;
            ts.AllowSorting = true;

            DataGridColumnStyle TextCol;

            TextCol = new DataGridReadOnlyColumn();
            TextCol.MappingName = "printer_id";
            TextCol.Width = 120;
            TextCol.HeaderText = "打印机ID";
            ts.GridColumnStyles.Add(TextCol);

            TextCol = new DataGridReadOnlyColumn();
            TextCol.MappingName = "location";
            TextCol.Width = 180;
            TextCol.HeaderText = "打印机位置";
            ts.GridColumnStyles.Add(TextCol);

            TextCol = new DataGridReadOnlyColumn();
            TextCol.MappingName = "description";
            TextCol.Width = 150;
            TextCol.HeaderText = "打印机位置描述";
            ts.GridColumnStyles.Add(TextCol);

            TextCol = new DataGridReadOnlyColumn();
            TextCol.MappingName = "client_name";
            TextCol.Width = 120;
            TextCol.HeaderText = "客户端机器名";
            ts.GridColumnStyles.Add(TextCol);

            TextCol = new DataGridReadOnlyColumn();
            TextCol.MappingName = "client_ip1";
            TextCol.Width = 100;
            TextCol.HeaderText = "客户端IP";
            ts.GridColumnStyles.Add(TextCol);

            TextCol = new DataGridReadOnlyColumn();
            TextCol.MappingName = "pclocation";
            TextCol.Width = 100;
            TextCol.HeaderText = "PC位置";
            ts.GridColumnStyles.Add(TextCol);

            return ts;
        }

该调用的我都调用了,就是加载的时候不显示表头,在线求救还有哪不对的

C#
暗夜的萤火虫的主页 暗夜的萤火虫 | 初学一级 | 园豆:8
提问于:2012-09-18 18:19
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册