当前位置: 首页>>代码示例>>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;未经允许,请勿转载。