當前位置: 首頁>>代碼示例>>C#>>正文


C# DataGrid.SuspendLayout方法代碼示例

本文整理匯總了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();
		}
開發者ID:bcokur,項目名稱:mydotnetsamples,代碼行數:16,代碼來源:SnippetDataGridHelper.cs

示例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)
//.........這裏部分代碼省略.........
開發者ID:hieu292,項目名稱:project-dms,代碼行數:101,代碼來源:clsStyleManager.cs


注:本文中的System.Windows.Forms.DataGrid.SuspendLayout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。