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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:14:21+00:00 2026-05-19T02:14:21+00:00

I have a usercontrol that inherits from a DataGridView. I have overridden OnRowPrePaint, OnRowPostPaint,

  • 0

I have a usercontrol that inherits from a DataGridView. I have overridden OnRowPrePaint, OnRowPostPaint, OnCellPaint, and some others so I can draw the entire thing as I want. Everything works beautifully, except the scrollbars. How can I intercept the scrollbars being painted and paint my own?

Ideally there is some datastructure that contains the bounds for the scroll bar itself as well as the bounds for actually scroll-slider. Then I can just draw on the graphics layer at those locations.

Is there a way to do this? It seems like everything else was though of, so I would imagine there is some way to do it…

  • 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-19T02:14:22+00:00Added an answer on May 19, 2026 at 2:14 am

    When inheriting from the scrollbar class, add this to Sub New:

    Me.SetStyle(ControlStyles.UserPaint, True)
    

    The OnPaint event will now fire.

    To override the standard buttons / slider from being drawn when clicking the control:

    Me.SetStyle(ControlStyles.UserMouse, True)
    

    And to reduce the flicker:

    Me.SetStyle(ControlStyles.AllPaintingInWmPaint, False)
    

    EDIT:

    I clearly need to learn to read.

    Didn’t notice the

    usercontrol that inherits from a
    DataGridView

    bit……..

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

Sidebar

Related Questions

I have a custom control that inherits from UserControl , and I can't get
I have a selfcreated usercontrol that inherits from canvas. Now it is nessesary that
Say I have a control that inherits from UserControl (hence one of its super
I have a user control that inherits from UserControl. It's a button so I'm
I have a UserControl called InputSensitiveTextBox that inherits from TextBox . It has a
I have an asp.net usercontrol (ascx) that inherits from an abstract class (that inherits
I have a UserControl that consists of three TextBoxes. On a form I can
I have a usercontrol that is meant to take up the entire form. I
I have a user control that inherits from the ListBox class and displays a
I have created a custom server control that inherits from CompositeControl. In the CreateChildControls

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.