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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:53:50+00:00 2026-05-13T16:53:50+00:00

I’m trying to get scrollbars working with the web browser control. However, as I’ll

  • 0

I’m trying to get scrollbars working with the web browser control. However, as I’ll be using it to display a message for a custom messagebox, I don’t want the scrollbar to appear even if its not needed – as it seems to do by default. To circumvent this I decided to disable scrollbars on the control and instead use scrollbars on another control like a Panel. This way they’ll only appear when the contents of the browser page is too big to fit.

This hasn’t worked out too well, though I’ve read quite a few posts, even on StackOverflow, where this seems to be a valid solution. One example is when I tried using the solution here:

Scrolling problem with a WebBrowser control contained in a Panel control

It seems as though if Scrollbars are disabled for the web browser, it won’t let the panel use scrollbars either. This seemed to be the case when testing in design mode. To overcome this I tried adding a picture box behind the web browser inside the panel; it worked when in design mode (resizing the picture box and web browser would cause the panel to enable its scrollbars), but didn’t work during runtime (I added code to have the picture box change to the size of the web browser control – which itself is always resized to fit the size of the scrollable contents).

I also tried programmatically enabling and disabling the web browser’s scrollbars based on if the ScrollableRectangle size was bigger than the size of the control. This theoretically would be fine, except it seems to clear all text within the control any time the ScrollbarsEnabled property is changed – and thus is changed back to having no scrollbars.

I’m doing this with the following code, called effectively whenever a key is pressed in the control:

if (Output.Document.Body != null)
{
    if (Output.Document.Body.ScrollRectangle.Size.Height > Output.Size.Height
            || Output.Document.Body.ScrollRectangle.Size.Width > Output.Size.Width)
        Output.ScrollBarsEnabled = true;
    else
        Output.ScrollBarsEnabled = false;
}
else
    Output.ScrollBarsEnabled = false;

It’s also important to note that I also need a solution for the HTML editor which will be used within the app, so ideally any solution would not rely on a page load event etc… as these do not seem to trigger when the web browser has design mode set to on (which is needed for it to work as an HTML editor). However, in this particular situation I can fall back on enabling the default scrollbars if there’s no better solution.

EDIT: To be clear, I am not talking about any scrollbars within the HTML content – that is of no concern as the HTML is simply being used to allow for flexible formatting of text. I’m talking only about the scrollbar of the browser control itself.

Any help much appreciated. Thanks!

  • 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-13T16:53:50+00:00Added an answer on May 13, 2026 at 4:53 pm

    I ended up finding a solution to this some time ago now, but forgot to post here. Basically what I did was first enable the scrollbars by default so they will work, although always appear. Then I created a panel control and sized it over the top of the inactive scrollbar that appears on the right of the web browser control.

    Next I changed the anchors of the scroll bar panel so that the top, bottom, and right sides would always snap into the size of the form, and hence the size of the browser control as all edges of it too are anchored.

    Then I added some code that checked the ScrollRectangle size and compared it with that of the browser, if it turned out to be larger in height or width, I then made the cover panel not visible, but otherwise left it in place.

    Here’s the relevant code snippets:

                //If still bigger, set scrollbars:
    
                if ((Output.Document.Body.ScrollRectangle.Size.Height > Output.Size.Height) ||
                    Output.Document.Body.ScrollRectangle.Size.Width > Output.Size.Width)
                {
                    ScrollPanel.Visible = false;
                    ScrollPanel.Enabled = false;
                }
    

    Hope this helps someone else in future, took a few different methods before I found one that worked well enough.

    I’ve decided to up Sheng’s answer (when I get enough reputation) as, firstly he was the only person to response, and secondly, his information helped me when I was contemplating the use of some kind of invocation to try and enable the scrollbars during runtime. Though I found my solution simpler and just as effective.

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

Sidebar

Ask A Question

Stats

  • Questions 362k
  • Answers 363k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer add this to the input field: onchange="testEdit(this)" and have a… May 14, 2026 at 3:16 pm
  • Editorial Team
    Editorial Team added an answer You need to make use of DragDrop.AddQueryContinueDragHandler(). Please see this… May 14, 2026 at 3:16 pm
  • Editorial Team
    Editorial Team added an answer You need to return a FileResult or ContentResult with a… May 14, 2026 at 3:16 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.