Devgridcontrol cell background color and cell text color settings

Source: Internet
Author: User
Tags set background

1. Drag a Gridcontrol control on the form

2. Add three columns are Bgcolor,bgcolor2, fontcolor respectively display cell color cells gradient color cell font Color


 Public partial class Form1:form {public Form1 () {InitializeComponent (); private void Form1_Load (object sender, EventArgs e) {list<object> List = new List<obj            Ect> (); List.            Add (New {BgColor = one, BgColor2 = n, fontcolor = 13}); List.            Add (New {BgColor = BgColor2, fontcolor = 23}); List.            Add (New {BgColor = +, BgColor2 = +, FontColor = 33});        Gridcontrol1.datasource = list;        private void Gridview1_rowcellstyle (object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)            {GridView View = sender as GridView; if (E.column.fieldname = = "BgColor")//Set Background {//int Pointid = (Gridview1.getrow (e.rowhandle) as OB ject).                BgColor;            E.appearance.backcolor = color.red; } else if (E.column.fieldname = = "BgColor2")//Set gradient background {//int PoinTID = (Gridview1.getrow (e.rowhandle) as Object).                BgColor;                E.appearance.backcolor = color.red;            E.appearance.backcolor2 = Color.FromArgb (255, 255, 255); } else if (E.column.fieldname = = "FontColor")//Set font Color {//int Pointid = (gridview1.get Row (E.rowhandle) as Object).                BgColor;            E.appearance.forecolor = Color.red;//color.fromargb (42, 173, 231); }        }    }


Devgridcontrol cell background color and cell text color settings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.