/**/
/// <summary>
/// 去掉网格中的TEXTBOX
/// </summary>
/// <param name="grid">需要去掉TEXTBOX的网格</param>
/// <param name="tableStyleIndex">网格样式索引号</param>
/// <returns></returns>
public static void ModifyDataGridStyle(DataGrid grid, int tableStyleIndex)
... {
DataGridTextBoxColumn dgtxt=null;
Type c=typeof(System.Windows.Forms.DataGridTextBoxColumn);
for(int i=0;i<grid.TableStyles[tableStyleIndex].GridColumnStyles.Count;i++)
...{
if(grid.TableStyles[tableStyleIndex].GridColumnStyles[i].GetType()==c || grid.TableStyles[tableStyleIndex].GridColumnStyles[i].GetType().IsSubclassOf(c))
...{
dgtxt=(DataGridTextBoxColumn)grid.TableStyles[tableStyleIndex].GridColumnStyles[i];
grid.Controls.Remove(dgtxt.TextBox);
}
}
}
/// 去掉网格中的TEXTBOX
/// </summary>
/// <param name="grid">需要去掉TEXTBOX的网格</param>
/// <param name="tableStyleIndex">网格样式索引号</param>
/// <returns></returns>
public static void ModifyDataGridStyle(DataGrid grid, int tableStyleIndex)
... {
DataGridTextBoxColumn dgtxt=null;
Type c=typeof(System.Windows.Forms.DataGridTextBoxColumn);
for(int i=0;i<grid.TableStyles[tableStyleIndex].GridColumnStyles.Count;i++)
...{
if(grid.TableStyles[tableStyleIndex].GridColumnStyles[i].GetType()==c || grid.TableStyles[tableStyleIndex].GridColumnStyles[i].GetType().IsSubclassOf(c))
...{
dgtxt=(DataGridTextBoxColumn)grid.TableStyles[tableStyleIndex].GridColumnStyles[i];
grid.Controls.Remove(dgtxt.TextBox);
}
}
}