i'm creating a user control in C# .net compact framework 3.5. And i'm using a DataGrid Control with a DataTable as the DataGrid's DataSource. i need to make some of the grid columns wider.
for some reason i can't...
i ju开发者_Python百科st couldn't find the method or property that controls the column width...
any ideas?
thanks in advance...
You're looking for the AutoSizeMode
and Width
properties of the columns.
sample code below -
foreach(DataGridColumnStyle vColumnStyle in myGrid.TableStyles[0].GridColumnStyles )
{
if (vColumnStyle.HeaderText.ToLower()=="mycolumn")
{
vColumnStyle.Width = 60;
}
}
精彩评论