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


C# DataGrid.ResumeLayout方法代碼示例

本文整理匯總了C#中System.Windows.Forms.DataGrid.ResumeLayout方法的典型用法代碼示例。如果您正苦於以下問題:C# DataGrid.ResumeLayout方法的具體用法?C# DataGrid.ResumeLayout怎麽用?C# DataGrid.ResumeLayout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Forms.DataGrid的用法示例。


在下文中一共展示了DataGrid.ResumeLayout方法的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


//.........這裏部分代碼省略.........
                grd.HeaderForeColor = Color.MidnightBlue;

                grd.CaptionBackColor = Color.FromArgb(231, 239, 245);
                grd.CaptionForeColor = Color.FromArgb(87, 157, 215);

                foreach(DataGridTableStyle grdStyle in grd.TableStyles)
                {
                    grdStyle.BackColor = Color.FromArgb(231, 239, 245);
                    grdStyle.SelectionBackColor = SystemColors.ActiveCaption;
                    grdStyle.SelectionForeColor = SystemColors.ActiveCaptionText;
                    grdStyle.AlternatingBackColor = Color.FromArgb(239, 243, 248);
                    grdStyle.BackColor = Color.White;
                    grdStyle.ForeColor = Color.MidnightBlue;
                    grdStyle.GridLineColor = Color.FromArgb(87, 157, 215);//128
                    grdStyle.HeaderBackColor = Color.FromArgb(231, 239, 245);//Color.FromArgb(255, 217, 183);//Color.FromArgb(229, 255, 255);//Color.Blue;//Color.MidnightBlue;
                    grdStyle.HeaderForeColor = Color.MidnightBlue;
                }
            }
            else if(ThemeColor == Style.Cyan)
            {
                grd.BackgroundColor = Color.FromArgb(233, 255, 244);

                grd.BackColor = Color.GhostWhite;;
                grd.SelectionBackColor = SystemColors.ActiveCaption;
                grd.SelectionForeColor = SystemColors.ActiveCaptionText;
                grd.AlternatingBackColor = Color.FromArgb(233, 255, 244);
                grd.BackColor = Color.White;
                grd.ForeColor = Color.DarkGreen;
                grd.GridLineColor = Color.FromArgb(0, 150, 0);//128
                grd.HeaderBackColor = Color.FromArgb(233, 255, 244);;//Color.FromArgb(255, 217, 183);//Color.FromArgb(229, 255, 255);//Color.Blue;//Color.MidnightBlue;
                grd.HeaderForeColor = Color.DarkGreen;

                grd.CaptionBackColor = Color.FromArgb(137, 197, 179);
                grd.CaptionForeColor = Color.FromArgb(233, 255, 244);

                foreach(DataGridTableStyle grdStyle in grd.TableStyles)
                {
                    grdStyle.BackColor = Color.GhostWhite;;
                    grdStyle.SelectionBackColor = SystemColors.ActiveCaption;
                    grdStyle.SelectionForeColor = SystemColors.ActiveCaptionText;
                    grdStyle.AlternatingBackColor = Color.FromArgb(233, 255, 244);
                    grdStyle.BackColor = Color.White;
                    grdStyle.ForeColor = Color.DarkGreen;
                    grdStyle.GridLineColor = Color.FromArgb(0, 150, 0);//128
                    grdStyle.HeaderBackColor = Color.FromArgb(233, 255, 244);;//Color.FromArgb(255, 217, 183);//Color.FromArgb(229, 255, 255);//Color.Blue;//Color.MidnightBlue;
                    grdStyle.HeaderForeColor = Color.DarkGreen;
                }
            }
            //else if(ThemeColor == Style.Orange)
            else
            {
                grd.BackgroundColor = Color.FromArgb(255, 250, 245);
                grd.AlternatingBackColor = Color.FromArgb(255, 250, 245);

                grd.BackColor = Color.GhostWhite;;
                grd.SelectionBackColor = SystemColors.ActiveCaption;
                grd.SelectionForeColor = SystemColors.ActiveCaptionText;
                grd.AlternatingBackColor = Color.FromArgb(255, 250, 245);
                grd.BackColor = Color.White;
                grd.ForeColor = Color.DarkRed;
                grd.GridLineColor = Color.FromArgb(255, 207, 159);
                grd.HeaderBackColor = Color.FromArgb(255, 250, 245);;//Color.FromArgb(255, 217, 183);//Color.FromArgb(229, 255, 255);//Color.Blue;//Color.MidnightBlue;
                grd.HeaderForeColor = Color.Brown;

                grd.CaptionBackColor = Color.FromArgb(139, 69, 19);
                grd.CaptionForeColor = Color.FromArgb(253, 245, 230);

                foreach(DataGridTableStyle grdStyle in grd.TableStyles)
                {
                    grdStyle.BackColor = Color.GhostWhite;;
                    grdStyle.SelectionBackColor = SystemColors.ActiveCaption;
                    grdStyle.SelectionForeColor = SystemColors.ActiveCaptionText;
                    grdStyle.AlternatingBackColor = Color.FromArgb(255, 250, 245);
                    grdStyle.BackColor = Color.White;
                    grdStyle.ForeColor = Color.DarkRed;
                    grdStyle.GridLineColor = Color.FromArgb(255, 207, 159);
                    grdStyle.HeaderBackColor = Color.FromArgb(255, 250, 245);;//Color.FromArgb(255, 217, 183);//Color.FromArgb(229, 255, 255);//Color.Blue;//Color.MidnightBlue;
                    grdStyle.HeaderForeColor = Color.Brown;
                }
            }
            //giong blue
            #endregion

            foreach (DataGridTableStyle grdStyle in grd.TableStyles)
            {
                foreach(DataGridColumnStyle col in grdStyle.GridColumnStyles)
                {
                    DataGridTextBoxColumn txtCol = col as DataGridTextBoxColumn;
                    if(txtCol != null)
                    {
                        TextBox txt = txtCol.TextBox;
                        if(txt.ReadOnly)
                            txt.ForeColor = Color.FromArgb(166,162,147);//(172,168,153);
                        txt.BackColor = Color.White;
                    }

                }
            }
            grd.ResumeLayout();
        }
開發者ID:hieu292,項目名稱:project-dms,代碼行數:101,代碼來源:clsStyleManager.cs


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