This article is reprinted. :http://www.cnblogs.com/hailexuexi/archive/2012/04/23/2466398.html

Code :

#region DataGridVeiw Style
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
            this.DataGridView1.AllowUserToAddRows = false;
            this.DataGridView1.AllowUserToDeleteRows = false;
            dataGridViewCellStyle1.BackColor = System.Drawing.Color.LightCyan;
            this.DataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
            this.DataGridView1.BackgroundColor = System.Drawing.Color.White;
            this.DataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.DataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;//211, 223, 240
            dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(211)))), ((int)(((byte)(223)))), ((int)(((byte)(240)))));
            dataGridViewCellStyle2.Font = new System.Drawing.Font(" Song style ", 9F, System.Drawing.FontStyle.Regular,       System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            dataGridViewCellStyle2.ForeColor = System.Drawing.Color.Navy;
            dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            this.DataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
            this.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.DataGridView1.EnableHeadersVisualStyles = false;
            this.DataGridView1.GridColor = System.Drawing.SystemColors.GradientInactiveCaption;
            this.DataGridView1.ReadOnly = true;
            this.DataGridView1.RowHeadersVisible = false; // It is suggested to change to true; In order to display the serial number later .
            this.DataGridView1.RowTemplate.Height = 23;
            this.DataGridView1.RowTemplate.ReadOnly = true;

winform Set up DataGridView style ( Blue ) More articles about

  1. [WinForm]- Set up DataGridView Display pictures in cells according to different values

    First, set the column to display the picture DataGridViewImageColumn status = new DataGridViewImageColumn(); status.DisplayIndex = ; ...

  2. c# WinForm Development DataGridView Control operation summary ( Cell manipulation , Property settings )

    One . Operation of cell content *****// Gets the contents of the current cell Console.WriteLine(DataGridView1.CurrentCell.Value); // Gets the column of the current cell Index ...

  3. turn :c# WinForm Development DataGridView Control operation summary ( Cell manipulation , Property settings )

    One . Operation of cell content *****// Gets the contents of the current cell Console.WriteLine(DataGridView1.CurrentCell.Value); // Gets the column of the current cell Index  ...

  4. Set up DatagridView Column header style of

    Set up DataGridView.ColumnHeaderDefaultCellStyle Of BackColor Properties will find no effect . This is because when visual styles are activated ,BackColor and ForeColor Value ...

  5. c# DataGridView Invalid style setting

    Yes DataGridView When you style certain lines in , Invalid , Finally found , I set the style first and then show it this.controls.Add, It should be done first , Then set the style .

  6. winform in dataGridView Cells set new values based on values , Completely solve the problem of data type conversion after binding

    // winform in dataGridView Cell after data binding , Data type change is difficult , It can only be achieved by detour . Sometimes it's necessary to transform numbers into different text descriptions , Will appear int32 To string Exception to type conversion , With the help of CellFo ...

  7. WinForm Control - DataGridView

    http://blog.csdn.net/fangxing80/article/details/1561011 .NET 2.0 - WinForm Control - DataGridView Programming ...

  8. DataGridView How to use Style Builder

    Look at the picture without saying anything One .       Function is introduced 1.      winform DataGridView Visual and instant generation of style code , What you see is what you get 2.      preset DataGridView Style code scheme Preset three ...

  9. be based on Winform frame DataGridView The control of SqlServer The realization of database query and display function

    key word :Winform.DataGridView.SqlServer One is based on winform Framework of the C/S Software , The main realization is to SqlServer Real time query of database data table . One . by DataGridView Add numbers ...

Random recommendation

  1. bash Ordinary arrays and associative arrays in scripts

    1. Normal array bash Supports one dimensional array ( Multidimensional arrays are not supported ), And there's no limit to the size of the array . Similar to C Language , The subscripts of array elements are 0 Numbered starting . To get the elements in an array, you need to use subscripts , Subscripts can be integers or arithmetic expressions , Its value should be greater than or equal to 0. ...

  2. Use CSS3 Of appearance Attributes change the appearance of elements

    Yesterday when I finished the project with my colleagues , I use the appearance To render select, But in firefox There's something wrong with it , Not perfect , In the end . But we still need to learn this attribute . We all know that every browser is right for HTML Element rendering is different ...

  3. Codeforces Round #206 div1 C

    CF I'm a professional : The problem was to find greatest d, such that ai ≥ d, ai mod d ≤ k holds for each i. Let ...

  4. servlet Of url-pattern The matching rules are described in detail

    One . summary Using servlet or Filter Conduct url When the requested match , The key point is the matching rules , but servlet Matching rules in containers are not simple general matching , It's not a regular expression , It's by your own rules , More confusing . In this article ...

  5. 【 Zi Fei Yu 】 Insert the sort process to present java built-in GUI Express

    Give the code first , And the video of the process : package com.dyi.wyb.sort; import java.awt.Color; import java.awt.Graphics; import java. ...

  6. Go Language memo : The principle and use of reflection

    Catalog : Preliminary knowledge reflect.Typeof.reflect.ValueOf Value.Type Dynamic invocation The original object can be modified by reflection The implementation is similar to “ Generic ” The function of   1. Preliminary knowledge : Go All of the variables are static classes ...

  7. Android Studio Set font and theme

    step :File >> settings >> Appearance & Behavior >> Appearance           >> ...

  8. MYSQL actual combat ------- Ding Qi ( Geek time ) Learning notes

    1. Infrastructure : One sql How query statements are executed ? mysql> select * from T where ID=10: 2. Infrastructure : One sql How update statements are executed ? mysql> upd ...

  9. HBase There are several ways to read and write ( One )java piece

    1.HBase The way of reading and writing It is mainly divided into : pure Java API Reading and writing HBase The way : Spark Reading and writing HBase The way : Flink Reading and writing HBase The way : HBase adopt Phoenix How to read and write : The first one is ...

  10. react Chapter -React State( state )- Add lifecycle methods to classes

    Add lifecycle methods to classes In applications with many components , It's very important to release the resources occupied by the component at the time of destruction . whenever Clock Component first loaded into DOM In the time , We all want to generate timers , This is in React Is called mount . ...