//控制Datagrid显示样式
private void AddGridTableStyle(System.Windows.Forms.DataGrid grdTemp)
{
grdTemp.TableStyles.Clear(); //先清空样式
//表格样式
DataGridTableStyle tempts=new DataGridTableStyle();
tempts.MappingName="ds";
//添加id行
DataGridTextBoxColumn equipmentId=new DataGridTextBoxColumn();
equipmentId.MappingName="equipmentId";
equipmentId.Width=0;
tempts.GridColumnStyles.Add(equipmentId);
//添加姓名行
DataGridTextBoxColumn equipmentXvliehao =new DataGridTextBoxColumn();
equipmentXvliehao.MappingName="equipmentXvliehao";
equipmentXvliehao.HeaderText="器材序列号 ";
equipmentXvliehao.Width=75;
tempts.GridColumnStyles.Add(equipmentXvliehao);
//加样式
grdTemp. TableStyles.Add(tempts);
}