Jump to content
  • Advertisement
Sign in to follow this  
nerd_boy

Scrollbars and Text

This topic is 3455 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Two questions, though they are really more of an either this question or that question type thing, if that makes any sense. First question, in my text control, I base the maximum value of the vertical scrollbar on the number of lines in the text. This is easy and simple to do since the text is kept track of in a line-by-line basis using LinkedList<T>. The 'problem' lies in the horizontal scrollbar. Other than comparing the sizes of the lines each time there is an edit, I'm not sure of any way to keep the horizontal scrollbar accurate at all times. The 'best' thing I've come up with so far is keeping track of the longest line, and everytime a line is edited, test that line against the current longest line, and so on and so forth. The problem with this is that when text is removed, the horizontal scrollbar's max value will remain the same, which means, if I have 1 one hundred char line and 100 ten char lines and the long line is reduced to ten chars, you'll still be able to scroll along as if the max was 100 chars. :/ Not sure if that is much of a problem, however. Second question, in place of or addition to the previous, if at all. How the deuce did System.Windows.Forms.TextBox handle its scrollbars? Reflector only shows it as using a var of the enumaration Scrollbars, and when its value is set, just calling base.RecreateHandle(). The code of the resulting function called(I think base.RecreateHandle() is just a call to another function, nothing else) kinda loses me, but I didn't see anything to indicate how TextBox did it. Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!