怎么设置dataGridView 列的宽度呢??
我用的是dataGridView 将数据放到table 里面 ,但是就不知道怎么去调整列宽了DataTable table = new DataTable();
DataColumn col1 = new DataColumn("消费项目", typeof(string));
DataColumn col2 = new DataColumn("折前金额", typeof(decimal));
DataColumn col3 = new DataColumn("折后金额", typeof(decimal));
DataColumn col4 = new DataColumn("折扣金额", typeof(decimal));
DataColumn col5 = new DataColumn("结帐方式", typeof(string));
DataColumn col6 = new DataColumn("金额", typeof(decimal));
table.Columns.Add(col1);
table.Columns.Add(col2);
table.Columns.Add(col3);
table.Columns.Add(col4);
table.Columns.Add(col5);
table.Columns.Add(col6);
//生成DataColumn
string sql = "select StatItem_name,StatItem_goodstype from Stat_item";
SqlDataReader dr = Class_data.DataAccess.GetReader(sql);
while (dr.Read())
{
DataRow row = table.NewRow();
row[0] = dr[0];
table.Rows.Add(row);
}
dataview.DataSource = table.DefaultView;
dr.Close();
在这里我应该怎么才能调整生成后的列的宽度呢?急需呀!!!!!!!!!!!!!
[此贴子已经被作者于2006-12-5 14:04:01编辑过]