本文整理汇总了C#中System.Windows.Forms.DataGrid.SuspendLayout方法的典型用法代码示例。如果您正苦于以下问题:C# DataGrid.SuspendLayout方法的具体用法?C# DataGrid.SuspendLayout怎么用?C# DataGrid.SuspendLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGrid
的用法示例。
在下文中一共展示了DataGrid.SuspendLayout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetSnippetGrid
internal static void SetSnippetGrid(Collection<Snippet> snippets, DataGrid grid)
{
grid.TableStyles.Clear();
DataTable dataSource = SnippetDataGridHelper.ToDataTable(snippets);
grid.SetDataBinding(dataSource, "");
DataGridTableStyle table = new DataGridTableStyle();
grid.TableStyles.Add(table);
grid.SuspendLayout();
grid.TableStyles[0].GridColumnStyles[2].Width = 168;
grid.TableStyles[0].GridColumnStyles[3].Width = 83;
grid.TableStyles[0].GridColumnStyles[4].Width = 83;
grid.TableStyles[0].GridColumnStyles[5].Width = 83;
grid.TableStyles[0].GridColumnStyles[6].Width = 83;
SnippetDataGridHelper.HideColumns(grid);
grid.ResumeLayout();
}
示例2: SetStyle
/// <summary>
/// Set style of DataGrid
/// </summary>
/// <param name="grd"></param>
/// <remarks>
/// Author: PhatLT. FPTSS.
/// Created date: 14/02/2011
/// </remarks>
public static void SetStyle(DataGrid grd)
{
grd.SuspendLayout();
// if(!grd.ReadOnly)
// if(grd.TableStyles[0].ReadOnly == false)
// {
// brColor = frmMain.brColor;
// DataGridTableStyle grdNew = new DataGridTableStyle();
// // if(grd.ReadOnly == true)
// // return;
// bool checkReadOnlyAll = true;
// foreach(DataGridTableStyle grdStyle in grd.TableStyles)
// {
//
//
// foreach(DataGridColumnStyle col in grdStyle.GridColumnStyles)
// {
// bool boolAdded = false;
// DataGridTextBoxColumn txtCol = col as DataGridTextBoxColumn;
// DataGridBoolColumn boolCol = col as DataGridBoolColumn;
// if(txtCol != null && txtCol.ReadOnly == false )//&& (grd.TableStyles[0].GridColumnStyles[i] is DataGridTextBoxColumn) )
// {
// FormattableTextBoxColumn colAdd = new FormattableTextBoxColumn();
// colAdd.MappingName = txtCol.MappingName;
// colAdd.ReadOnly = false;
// colAdd.TextBox.MaxLength = txtCol.TextBox.MaxLength;
// colAdd.NullText = txtCol.NullText;
// clsCommon.RegNumberOnly(colAdd.TextBox);
// colAdd.HeaderText = txtCol.HeaderText;
// colAdd.SetCellFormat += new FormatCellEventHandler(SetHeaderCellFormat);
// //arlCol.Add(colAdd);
// grdNew.GridColumnStyles.Add(colAdd);
// boolAdded = true;
// checkReadOnlyAll = false;
// }
// if(boolCol!= null && boolCol.ReadOnly == false)
// {
// FormattableBooleanColumn colBoolAdd = new FormattableBooleanColumn();
// colBoolAdd.MappingName = boolCol.MappingName;
// colBoolAdd.ReadOnly = false;
// colBoolAdd.TrueValue = boolCol.TrueValue;;
// colBoolAdd.FalseValue =boolCol.FalseValue;
// colBoolAdd.AllowNull = boolCol.AllowNull;
// colBoolAdd.HeaderText = boolCol.HeaderText;
// colBoolAdd.SetCellFormat += new FormatCellEventHandler(SetHeaderCellFormat);
// grdNew.GridColumnStyles.Add(colBoolAdd);
// boolAdded = true;
// checkReadOnlyAll = false;
// }
// if(!boolAdded)grdNew.GridColumnStyles.Add(col);
// }
//
// }
// if(!checkReadOnlyAll)
// {
// grdNew.HeaderBackColor = grd.TableStyles[0].HeaderBackColor;
// grd.TableStyles.RemoveAt(0);
// grd.TableStyles.Add(grdNew);
// }
// }
if(ThemeColor == Style.Blue)
{
grd.BackgroundColor = Color.FromArgb(217, 232, 252);
grd.SelectionBackColor = SystemColors.ActiveCaption;
grd.SelectionForeColor = SystemColors.ActiveCaptionText;
grd.AlternatingBackColor = Color.FromArgb(227, 242, 252);
grd.BackColor = Color.White;
grd.ForeColor = Color.DarkBlue;
grd.GridLineColor = Color.RoyalBlue;
grd.HeaderBackColor = Color.FromArgb(217, 232, 252);//Color.FromArgb(229, 255, 255);//Color.Blue;//Color.MidnightBlue;
grd.HeaderForeColor = Color.MidnightBlue;
grd.CaptionBackColor = Color.RoyalBlue;
grd.CaptionForeColor = Color.Bisque;
grd.ParentRowsBackColor = Color.Lavender;
grd.ParentRowsForeColor = Color.MidnightBlue;
foreach(DataGridTableStyle grdStyle in grd.TableStyles)
{
grdStyle.SelectionBackColor = SystemColors.ActiveCaption;
grdStyle.SelectionForeColor = SystemColors.ActiveCaptionText;
grdStyle.AlternatingBackColor = Color.FromArgb(227, 242, 252);
grdStyle.BackColor = Color.White;
grdStyle.ForeColor = Color.DarkBlue;
grdStyle.GridLineColor = Color.RoyalBlue;
grdStyle.HeaderBackColor = Color.FromArgb(217, 232, 252);//Color.FromArgb(229, 255, 255);//Color.Blue;//Color.MidnightBlue;
grdStyle.HeaderForeColor = Color.MidnightBlue;
}
}
#region not blue
else if(ThemeColor == Style.Silver)
//.........这里部分代码省略.........