多谢各位高手赐教。。急。。
// C#
// Declare a new DataGridTableStyle in the
// declarations area of your form.
DataGridTableStyle ts = new DataGridTableStyle();
private void hideColumn()
{
// Set the DataGridTableStyle.MappingName property
// to the table in the data source to map to.
ts.MappingName = dataGrid1.DataMember;
// Add it to the datagrid's TableStyles collection
dataGrid1.TableStyles.Add(ts);
// Hide the first column (index 0)
dataGrid1.TableStyles[0].GridColumnStyles[0].Width = 0;
}
// C#
// Declare a new DataGridTableStyle in the
// declarations area of your form.
DataGridTableStyle ts = new DataGridTableStyle(); // 声明一个DataGridTableStyle对象ts
private void hideColumn()
{
// Set the DataGridTableStyle.MappingName property
// to the table in the data source to map to.
ts.MappingName = dataGrid1.DataMember; // 把ts的MappingName属性设置为dataGrid1的数据表名
// Add it to the datagrid's TableStyles collection
dataGrid1.TableStyles.Add(ts); // 把ts加入到dataGrid1的TableStyles中去
// Hide the first column (index 0)
dataGrid1.TableStyles[0].GridColumnStyles[0].Width = 0; // 把第一列的列宽设置为0
}
[此贴子已经被作者于2006-3-15 16:14:41编辑过]