Exemple #1
0
        private void StyleGrid()
        {
            this.BorderStyle               = System.Windows.Forms.BorderStyle.None;
            this.CellBorderStyle           = DataGridViewCellBorderStyle.None;
            this.EnableHeadersVisualStyles = false;
            this.SelectionMode             = DataGridViewSelectionMode.FullRowSelect;

            this.BackColor       = MetroPaint.BackColor.DataGrid.Normal(Theme);      //MetroPaint.BackColor.Form(Theme);
            this.BackgroundColor = MetroPaint.BackColor.DataGrid.Background(Theme);  //MMetroPaint.BackColor.Form(Theme);
            this.GridColor       = MetroPaint.BorderColor.DataGrid.GridColor(Theme); // MetroPaint.BackColor.Form(Theme);
            this.ForeColor       = MetroPaint.ForeColor.DataGrid.Normal(Theme);

            this.Font = MetroFonts.DataGrid(metroDataGridSize, metroDataGridWeight); //new Font("Segoe UI", 11f, FontStyle.Regular, GraphicsUnit.Pixel);

            this.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
            this.AllowUserToResizeRows   = false;

            this.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
            this.ColumnHeadersDefaultCellStyle.BackColor          = MetroPaint.BackColor.DataGrid.ColumnHeadersDefaultCellStyle(Theme, Style);                   // MetroPaint.GetStyleColor(Style);
            this.ColumnHeadersDefaultCellStyle.ForeColor          = MetroPaint.ForeColor.DataGrid.ColumnHeadersDefaultCellStyle(Theme, Style);
            this.ColumnHeadersDefaultCellStyle.SelectionBackColor = MetroPaint.BackColor.DataGrid.ColumnHeadersDefaultCellStyleSelectionBackColor(Theme, Style); //MetroPaint.GetStyleColor(Style);
            this.ColumnHeadersDefaultCellStyle.SelectionForeColor = MetroPaint.ForeColor.DataGrid.ColumnHeadersDefaultCellStyleSelectionForeColor(Theme, Style); //(Theme == MetroThemeStyle.Light) ? Color.FromArgb(17, 17, 17) : Color.FromArgb(255, 255, 255);
            this.ColumnHeadersDefaultCellStyle.Font = MetroFonts.DataGrid(MetroDataGridSize.Medium, MetroDataGridWeight.Bold);

            this.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
            this.RowHeadersDefaultCellStyle.BackColor          = MetroPaint.BackColor.DataGrid.RowHeadersDefaultCellStyle(Theme, Style);                   //MetroPaint.GetStyleColor(Style);
            this.RowHeadersDefaultCellStyle.ForeColor          = MetroPaint.ForeColor.DataGrid.RowHeadersDefaultCellStyle(Theme, Style);
            this.RowHeadersDefaultCellStyle.SelectionBackColor = MetroPaint.BackColor.DataGrid.RowHeadersDefaultCellStyleSelectionBackColor(Theme, Style); //MetroPaint.BackColor.DataGrid.RowHeadersDefaultCellStyleSelectionBackColor(Theme, Style); //MetroPaint.GetStyleColor(Style);
            this.RowHeadersDefaultCellStyle.SelectionForeColor = MetroPaint.ForeColor.DataGrid.RowHeadersDefaultCellStyleSelectionForeColor(Theme, Style); //(Theme == MetroThemeStyle.Light) ? Color.FromArgb(17, 17, 17) : Color.FromArgb(255, 255, 255);
            this.RowHeadersDefaultCellStyle.Font = MetroFonts.DataGrid(MetroDataGridSize.Medium, MetroDataGridWeight.Bold);

            this.DefaultCellStyle.BackColor          = MetroPaint.BackColor.DataGrid.DefaultCellStyle(Theme);                          //MetroPaint.BackColor.Form(Theme);
            this.DefaultCellStyle.SelectionBackColor = MetroPaint.BackColor.DataGrid.DefaultCellStyleSelectionBackColor(Theme, Style); //MetroPaint.GetStyleColor(Style);
            this.DefaultCellStyle.SelectionForeColor = MetroPaint.ForeColor.DataGrid.DefaultCellStyleSelectionForeColor(Theme, Style); //(Theme == MetroThemeStyle.Light) ? Color.FromArgb(17, 17, 17) : Color.FromArgb(255, 255, 255);
            this.DefaultCellStyle.SelectionBackColor = MetroPaint.BackColor.DataGrid.DefaultCellStyleSelectionBackColor(Theme, Style); //MetroPaint.GetStyleColor(Style);
            this.DefaultCellStyle.SelectionForeColor = MetroPaint.ForeColor.DataGrid.DefaultCellStyleSelectionForeColor(Theme, Style); //(Theme == MetroThemeStyle.Light) ? Color.FromArgb(17, 17, 17) : Color.FromArgb(255, 255, 255);
            this.DefaultCellStyle.Font = MetroFonts.DataGrid(MetroDataGridSize.Medium, MetroDataGridWeight.Regular);
        }