Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9134453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:39:42+00:00 2026-06-17T08:39:42+00:00

I have asked this question some time ago Hide some datagridview checkbox cell .

  • 0

I have asked this question some time ago Hide some datagridview checkbox cell. I couldn´t get a good answer, so I decided to try something different.

I have a grid with all the installments of a loan. Every installment has a checkbox. When that checkbox is checked, I´m indicating that the client is paying for that one.

Now, when a installment is already paid, the checkbox is not needed. Right now, I disabled the checkbox for payed installments. It´s visible, but when clicked it does nothing. But i wanted to do is to paint the checkbox in green. Like in this image (the color was painted in Paint, its not a real image)

enter image description here

Ok, I have tried to hide the checkbox before using this code:

private void dgv_Cuotas_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
    {           
        if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
        {
            if (dgv_Cuotas.Columns[e.ColumnIndex].Name == "Seleccionar" && Convert.ToBoolean(dgv_Cuotas.Rows[e.RowIndex].Cells["pagada"].Value) == true)
            {
                e.CellStyle.BackColor = Color.Green;
                e.PaintBackground(e.ClipBounds, true);
                e.Handled = true;
            }
        }
    }

enter image description here

With this I paint the whole cell, but I just want to paint the checkbox. Also, with this implementation, when I click that cell, I can notice I´m clicking a checkbox, and the background color turns white, like this:

enter image description here

I´m creating the DataGridView (dgv_Cuotas) Rows and Columns by assingning Datasource = lista_cuota (List of installments) during runtime. Thats why the checkbox column is added after it by code:

DataGridViewCheckBoxColumn chbox = new DataGridViewCheckBoxColumn();
        {
            chbox.CellTemplate = new DataGridViewCheckBoxCell();
            chbox.HeaderText = "";
            chbox.Name = "Seleccionar";
            chbox.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            chbox.FlatStyle = FlatStyle.Standard;
        }
        dgv_Cuotas.Columns.Insert(16, chbox);
        dgv_Cuotas.Columns[16].DisplayIndex = 0;

Doing it this way, I cant “hide” the checkbox cell assigning a DataGridViewTextBoxCell to a specific cell, so I wanted to try painting just the checkbox instead.

As I´m using Entity framework, I don´t want to add new fields to the class.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:39:43+00:00Added an answer on June 17, 2026 at 8:39 am

    With all my research, I reach the conclusion that changing the color of the CheckBoxCell is not possible. I could simulate it by drawing a rectangle of the same size. I wrote that solution in another of my questions Drawing a filled circle or rectangle inside a DataGridViewCell in C# Winforms

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have asked this question some time ago to get an idea of speeding
This question was asked and answered some time ago link . However the answer
I have asked this question before but did not get the satisfied answer as
I have asked this question before - but I have spent some time thinking
I've already asked question similar to this some time ago, I thought I solved
Please have a look at the following question, which i asked some time ago:
I have just asked this question an hour ago but with regards to IE8
Guys I've asked few days ago a question and didn't have really time to
I've asked this question recently a few different ways, but don't get an answer
Some time ago I asked a question about nested loops on SO and as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.