简体   繁体   中英

How to change the datagridView Header font color using combobox c#

Now the datagridView Header font color is showing in black. I want to change it to differenct color using combobox .

My combobox contain color picker

在此处输入图片说明

private void cmbfontcolor_DropDown(object sender, EventArgs e)
        {
            ColorDialog cd = new ColorDialog();
            if (cd.ShowDialog() == DialogResult.OK)
            {
                cmbfontcolor.BackColor = cd.Color;
            }
        }

When select some color and click ok buton in color picker my combobox get that color as it back color

在此处输入图片说明

Now what i need is my form contain ok button when i click the button my datagridview Header fontcolor need to change to that color. help me

使用这个简单的代码在组合框颜色选择器的帮助下制作不同颜色的 datagridview 字体。

dataGridView1.ColumnHeadersDefaultCellStyle.ForeColor= cmbbgcolor.BackColor;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM