设置GirdView列宽
复制代码 代码如下:
/// <summary>
/// 设定GirdView列宽度
/// </summary>
/// <param name="sourceView"></param>
/// <param name="width"></param>
public void SetGridViewColumnWidth(GridView sourceView)
{
double cellWidth = sourceView.Width.Value;
for (int i = 0; i < sourceView.Rows.Count; i++)
{
for(int j = 0;j < sourceView.Rows[i].Cells.Count;j++)
{
sourceView.Rows[i].Cells[j].Width = Convert.ToInt16(cellWidth);
}
}
}