[Form]DataGridView 換行 自動調高

摘要:[Form]DataGridView 換行 自動調高


 
 
如上圖
DataGridView自動換行
DetailQuery.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
 
DataGridView自動調寬
DetailQuery.AutoResizeColumns();
 
DataGridView自動調高
DetailQuery.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders;
 
 
 
/=============================
newRow["Context"] = Context;
dtShow.Columns.Add("Context", typeof(String));
 
newRow["Context"] = FormatXMLString(Context, dateTimeString);
 
DetailQuery.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
 
DetailQuery.AutoResizeColumns();
DetailQuery.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders;