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 6821423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:32:37+00:00 2026-05-26T21:32:37+00:00

I am working with a DataGridView in winforms that I am handling the CellPainting

  • 0

I am working with a DataGridView in winforms that I am handling the CellPainting event for to paint all the cells myself.

My grid is virtual and has all of it’s data stored in a custom data structure centered around a MemoryStream.

All of my painting has been going fine, until a user Shift + clicks to select a large range of cells at once (25,000+), which have to be added to a selected cells collection, have a bunch of flags set, and other performance-draining operations.

Is there any way to prevent the DataGridView from “selecting” a cell so I can handle this operation separately in a more efficient manner?

  • 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-26T21:32:37+00:00Added an answer on May 26, 2026 at 9:32 pm

    A bit confused on the issue here.

    If you don’t want them to be able to select multiple-cells at all, set

    dataGridView.MultiSelect = false
    

    You say they ctrl+click 25k cells – are you suggesting they select 25k cells one-at-a-time (that is how ctrl+click works)? If you mean they shift-click to select a range, then simply handle the SelectionChanged event, and do whatever you need to do with dataGridView.SelectedRows. SelectionChanged will only be called once, for the entire selection.

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

Sidebar

Related Questions

I'm working on creating a custom winforms datagridview control that inherits the built in
I have a DataGridView control in a winforms app that I'm working on. The
i am working on a DataGridView in C# 3.5, in winforms application. I have
I want to display data from database in DataGridView...This is my code...Its not working...Can
After I added drag & drop to a DataGridView, the CellDoubleClick event stopped working.
I'm working on a Form that contains a datagridview and textbox, I need the
I need to programmatically change the border of individual cells in a WinForms DataGridView.
I'm working on a C# application (windows form) which has a DataGridView which is
I'm trying to hack together a datagridview in c# that can handle hierarchical data
I am working on WinForms, .NET2 project. I am using a DataGridView control to

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.