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

  • Home
  • SEARCH
  • 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 208331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:48:57+00:00 2026-05-11T17:48:57+00:00

I’ve got a DataGridView in a modal window with a list of options for

  • 0

I’ve got a DataGridView in a modal window with a list of options for my program. The grid has two collumns. The first one contains a checkbox for selecting that option, the seccond is the name/description of that option. The winform also contains OK and cancel buttons but that’s beside the point. The code below does what I want it to. Because of the FullRowSelect property the checkbox is checked/unchecked in you click anywhere withint that row. It does however not show a blue background or a dotted line around the current row anymore. How would I be able to add this without loosing any of the current functionality?

EDIT: To elaborate; what I want is to once again enable the dotted line and/or blue background on the selected row/cells. It looks like the code I have currently somehow disables this…

Relevant current code:

public OptionsForm()
{
    InitializeComponent();
    OptionsRoot = Options.GetReadOnlyRoot(OptionsBannersNameValueList.GetNameValueList(Settings.Default.OptionsBanners));
    optionsBannersDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
    optionsBannersDataGridView.MultiSelect = false;
    optionsBannersDataGridView.RowPrePaint += new DataGridViewRowPrePaintEventHandler(optionsBannersDataGridView_RowPrePaint);
    InitUI();
    Closing += MyFormClosing;
    BindingSourceTree = BindingSourceHelper.InitializeBindingSourceTree(components, rootBindingSource);
}

private void optionsBannersDataGridView_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
{
    e.PaintParts &= ~DataGridViewPaintParts.Focus;
}
  • 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-05-11T17:48:57+00:00Added an answer on May 11, 2026 at 5:48 pm

    What I finally ened up doing was remove most of the code mentioned above, as it really didn’t do much. for some reason when I set the properties in visual studio it did not work, but now it does. I don’t know what happened there but thats beside the point.

    The constructor now looks like this:

    public OptionsForm()
        {
            InitializeComponent();
            AlternativerRoot = Alternativer.GetReadOnlyRoot(AlternativerFanerNameValueList.GetNameValueList(Settings.Default.AlternativerFaner));
            InitUI();
            Closing += MyFormClosing;
            _bindingSourceTree = BindingSourceHelper.InitializeBindingSourceTree(components, rootBindingSource);
        }
    

    The properties are set in the visual studio GUI instead. SelectionMode is set to FullRowSelect and MultiSelect is set to false.

    I still didn’t get the focus I wanted so I set the backcolor of of the selected row to blue and the forecolor to white in visual studio. This now works like I wanted it to.

    I still don’t know why the properties were not getting set properly earlier, but at least it works now 😛

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

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
In my XML file chapters tag has more chapter tag.i need to display chapters

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.