C#2.0 I'm sure this was asked before but I wasn't able to find anything.
--- How to automatically scroll through the text in a RichTextBox when the lines of text go beyond the lower border of the control (like when adding new lines of text in a "status window" type operation)
I know I can set SelectionStart to the end, or ScrollToCaret but these methods/properties require the RichTextBox have the focus.
In this case, my richtextbox is read-only, so the user would never normally put the focus in there, plus the operation that is putting the new lines of text in there takes many minutes to run, so it's not acceptable to keep the focus in there anyway.
Well for the time being if the user happens to have the form in question as the app's active form then I'm going to set the focus in that RichTextBox.. But otherwise I wont.
I don’t think many of my users position the windows in such a way where if the window was in the background they would arrange it so that they can see the progress of the output.
-----Original Message-----> From: Discussion forum for developers using Windows Forms to > build apps and controls > [mailtoOTNET-WINFORMS@DISCUSS.DEVELOP.COM] On Behalf Of Vince P> Sent: Wednesday, March 08, 2006 12:56 AM> To: DOTNET-WINFORMS@DISCUSS.DEVELOP.COM> Subject: [DOTNET-WINFORMS] RichTextBox - autoscrolling>
C#2.0> I'm sure this was asked before but I wasn't able to find anything.>
--- How to automatically scroll through the text in a > RichTextBox when the lines of text go beyond the lower > border of the control (like when adding new lines of text in > a "status window" type operation)>
I know I can set SelectionStart to the end, or ScrollToCaret > but these methods/properties require the RichTextBox have the focus.>
In this case, my richtextbox is read-only, so the user would > never normally put the focus in there, plus the operation > that is putting the new lines of text in there takes many > minutes to run, so it's not acceptable to keep the focus in > there anyway.>
I haven't tried it specifically with RichTextBox; but, you might want to have a look at the RichTextBox.AutoScrollOffset member and the ScrollControlIntoView method (not to mention the AutoScroll property).
I'd have to play around with these in the context of RichTextBox to offer any guidance on how it differs from other controls.
If it works for you, I'd be interested in the results.
On Wed, 8 Mar 2006 00:55:47 -0600, Vince P <vincep1974@COMCAST.NET> wrote:
C#2.0>I'm sure this was asked before but I wasn't able to find anything.>
--- How to automatically scroll through the text in a RichTextBox when
the lines of text go beyond the lower border of the control (like when adding new lines of text in a "status window" type operation)>
I know I can set SelectionStart to the end, or ScrollToCaret but these
methods/properties require the RichTextBox have the focus.>
In this case, my richtextbox is read-only, so the user would never
normally put the focus in there, plus the operation that is putting the new lines of text in there takes many minutes to run, so it's not acceptable to keep the focus in there anyway.>
Ok based on your advise, I did try AutoScrollOffset. That method wants the location (System.Drawing.Point) of where to scroll to. I don't know how to get the size of the entire text area (which would include the size of the control + the size of the hidden text portion).
AutoScroll isn't a proprty of RTB. ScrollControlIntoView isn't a method of RTB.
Since the solution to this isn't so obvious, I rather not spend all this time trying to solve it, having other priorties.
-----Original Message----- From: Discussion forum for developers using Windows Forms to build apps and controls [mailtoOTNET-WINFORMS@DISCUSS.DEVELOP.COM] On Behalf Of Peter Ritchie Sent: Wednesday, March 08, 2006 9:05 AM To: DOTNET-WINFORMS@DISCUSS.DEVELOP.COM Subject: Re: [DOTNET-WINFORMS] RichTextBox - autoscrolling
I haven't tried it specifically with RichTextBox; but, you might want to have a look at the RichTextBox.AutoScrollOffset member and the ScrollControlIntoView method (not to mention the AutoScroll property).
I'd have to play around with these in the context of RichTextBox to offer any guidance on how it differs from other controls.
If it works for you, I'd be interested in the results.
On Wed, 8 Mar 2006 00:55:47 -0600, Vince P <vincep1974@COMCAST.NET> wrote:
C#2.0>I'm sure this was asked before but I wasn't able to find anything.>
--- How to automatically scroll through the text in a RichTextBox when
the lines of text go beyond the lower border of the control (like when adding new lines of text in a "status window" type operation)>
I know I can set SelectionStart to the end, or ScrollToCaret but these
methods/properties require the RichTextBox have the focus.>
In this case, my richtextbox is read-only, so the user would never
normally put the focus in there, plus the operation that is putting the new lines of text in there takes many minutes to run, so it's not acceptable to keep the focus in there anyway.>
Sorry, I should have mentioned ScrollControlIntoView and AutoScroll are members of the Form class used in a child/parent relationship, I suppose. Yes, it's unclear what you're supposed to use for a Point to AutoScrollOffset.
On Wed, 8 Mar 2006 13:29:33 -0600, Vince P <vincep1974@COMCAST.NET> wrote:
Ok based on your advise, I did try AutoScrollOffset. That method wants
location (System.Drawing.Point) of where to scroll to. I don't know how
get the size of the entire text area (which would include the size of the>control + the size of the hidden text portion).>
AutoScroll isn't a proprty of RTB. ScrollControlIntoView isn't a method
RTB.>
Since the solution to this isn't so obvious, I rather not spend all this>time trying to solve it, having other priorties.>
-----Original Message----->From: Discussion forum for developers using Windows Forms to build apps
controls [mailtoOTNET-WINFORMS@DISCUSS.DEVELOP.COM] On Behalf Of Peter>Ritchie>Sent: Wednesday, March 08, 2006 9:05 AM>To: DOTNET-WINFORMS@DISCUSS.DEVELOP.COM>Subject: Re: [DOTNET-WINFORMS] RichTextBox - autoscrolling>
I haven't tried it specifically with RichTextBox; but, you might want to>have a look at the RichTextBox.AutoScrollOffset member and the>ScrollControlIntoView method (not to mention the AutoScroll property).>
I'd have to play around with these in the context of RichTextBox to offer>any guidance on how it differs from other controls.>
If it works for you, I'd be interested in the results.>
On Wed, 8 Mar 2006 00:55:47 -0600, Vince P <vincep1974@COMCAST.NET> wrote:>
C#2.0>>I'm sure this was asked before but I wasn't able to find anything.>>
--- How to automatically scroll through the text in a RichTextBox when>the lines of text go beyond the lower border of the control (like when>adding new lines of text in a "status window" type operation)>>
I know I can set SelectionStart to the end, or ScrollToCaret but these>methods/properties require the RichTextBox have the focus.>>
In this case, my richtextbox is read-only, so the user would never>normally put the focus in there, plus the operation that is putting the
lines of text in there takes many minutes to run, so it's not acceptable
If you would like to report an abuse of our service, such as a spam message, please . Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .