<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Implementing a scrolling RichTextBox</title>
	<atom:link href="http://bitmatic.com/c/implementing-a-scrolling-richtextbox/feed" rel="self" type="application/rss+xml" />
	<link>http://bitmatic.com/c/implementing-a-scrolling-richtextbox</link>
	<description>Lean IT-solutions in .NET/C#</description>
	<lastBuildDate>Thu, 19 Jan 2012 08:45:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Barklc</title>
		<link>http://bitmatic.com/c/implementing-a-scrolling-richtextbox/comment-page-1#comment-44</link>
		<dc:creator>Barklc</dc:creator>
		<pubDate>Wed, 14 Apr 2010 15:21:38 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=283#comment-44</guid>
		<description>I love the solution.  How can you determine if you have scrolled all the way to the bottom?</description>
		<content:encoded><![CDATA[<p>I love the solution.  How can you determine if you have scrolled all the way to the bottom?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harvo</title>
		<link>http://bitmatic.com/c/implementing-a-scrolling-richtextbox/comment-page-1#comment-43</link>
		<dc:creator>Harvo</dc:creator>
		<pubDate>Mon, 07 Dec 2009 20:11:59 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=283#comment-43</guid>
		<description>Hi Jakob and Yamen,

Most other solutions on the web for this problem say to use the ScrolLToCarret() method.  This method had two problems for me:

1) The scrollbar of the RichTextBox would flicker (jump up and then down) whenever I called ScrolLToCarret().

2) The RichTextBox would never scroll *all the way* down.  It would always stop a few pixels above the bottom (so annoying!).

Your solution solves both of these problems and makes my work look a bit more professional :).  Kudos to you and many thanks.

- Harvo</description>
		<content:encoded><![CDATA[<p>Hi Jakob and Yamen,</p>
<p>Most other solutions on the web for this problem say to use the ScrolLToCarret() method.  This method had two problems for me:</p>
<p>1) The scrollbar of the RichTextBox would flicker (jump up and then down) whenever I called ScrolLToCarret().</p>
<p>2) The RichTextBox would never scroll *all the way* down.  It would always stop a few pixels above the bottom (so annoying!).</p>
<p>Your solution solves both of these problems and makes my work look a bit more professional <img src='http://bitmatic.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .  Kudos to you and many thanks.</p>
<p>- Harvo</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://bitmatic.com/c/implementing-a-scrolling-richtextbox/comment-page-1#comment-39</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Tue, 20 Oct 2009 19:00:50 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=283#comment-39</guid>
		<description>Holy cow, thanks, this is great! And thanks to Yamen as well for repackaging the solution :)</description>
		<content:encoded><![CDATA[<p>Holy cow, thanks, this is great! And thanks to Yamen as well for repackaging the solution <img src='http://bitmatic.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jakob</title>
		<link>http://bitmatic.com/c/implementing-a-scrolling-richtextbox/comment-page-1#comment-42</link>
		<dc:creator>Jakob</dc:creator>
		<pubDate>Mon, 19 Oct 2009 06:47:01 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=283#comment-42</guid>
		<description>That&#039;s brilliant Yamen, Thanks.</description>
		<content:encoded><![CDATA[<p>That&#8217;s brilliant Yamen, Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yamen Sader</title>
		<link>http://bitmatic.com/c/implementing-a-scrolling-richtextbox/comment-page-1#comment-41</link>
		<dc:creator>Yamen Sader</dc:creator>
		<pubDate>Mon, 19 Oct 2009 00:59:44 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=283#comment-41</guid>
		<description>Apologies, I don&#039;t know how to format code in comments, I assumed [code][/code].

Also the usage method should be:

private void anyTextBox_TextChanged(object sender, EventArgs e)
{
    anyTextBox.ScrollToBottom();
}</description>
		<content:encoded><![CDATA[<p>Apologies, I don&#8217;t know how to format code in comments, I assumed [code][/code].</p>
<p>Also the usage method should be:</p>
<p>private void anyTextBox_TextChanged(object sender, EventArgs e)<br />
{<br />
    anyTextBox.ScrollToBottom();<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yamen Sader</title>
		<link>http://bitmatic.com/c/implementing-a-scrolling-richtextbox/comment-page-1#comment-40</link>
		<dc:creator>Yamen Sader</dc:creator>
		<pubDate>Mon, 19 Oct 2009 00:58:37 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=283#comment-40</guid>
		<description>I&#039;m a little late, but thanks for this brilliant bit of code. I&#039;ve turned it into an Extension method, which makes it automatically usable in on any TextBoxBase class without any pesky inheritance.

[code]
using System;
using System.Runtime.InteropServices;

namespace Extensions
{
    public static class UIExtensions
    {
        [DllImport(&quot;user32.dll&quot;, CharSet = CharSet.Auto)]
        private static extern IntPtr SendMessage(
          IntPtr hWnd,
          uint Msg,
          IntPtr wParam,
          IntPtr lParam);

        private const int WM_VSCROLL = 277;
        private const int SB_LINEUP = 0;
        private const int SB_LINEDOWN = 1;
        private const int SB_TOP = 6;
        private const int SB_BOTTOM = 7;

        public static void ScrollToBottom(this System.Windows.Forms.TextBoxBase tb)
        {
            SendMessage(tb.Handle, WM_VSCROLL, new IntPtr(SB_BOTTOM), new IntPtr(0));
        }

        public static void ScrollToTop(this System.Windows.Forms.TextBoxBase tb)
        {
            SendMessage(tb.Handle, WM_VSCROLL, new IntPtr(SB_TOP), new IntPtr(0));
        }

        public static void ScrollLineDown(this System.Windows.Forms.TextBoxBase tb)
        {
            SendMessage(tb.Handle, WM_VSCROLL, new IntPtr(SB_LINEDOWN), new IntPtr(0));
        }

        public static void ScrollLineUp(this System.Windows.Forms.TextBoxBase tb)
        {
            SendMessage(tb.Handle, WM_VSCROLL, new IntPtr(SB_LINEUP), new IntPtr(0));
        }

    }
}
[/code]

Usage is exactly the same:

[code]
        private void anyTextBox_TextChanged(object sender, EventArgs e)
        {
            textLogMain.ScrollToBottom();
        }
[/code]</description>
		<content:encoded><![CDATA[<p>I&#8217;m a little late, but thanks for this brilliant bit of code. I&#8217;ve turned it into an Extension method, which makes it automatically usable in on any TextBoxBase class without any pesky inheritance.</p>
<p>[code]<br />
using System;<br />
using System.Runtime.InteropServices;</p>
<p>namespace Extensions<br />
{<br />
    public static class UIExtensions<br />
    {<br />
        [DllImport("user32.dll", CharSet = CharSet.Auto)]<br />
        private static extern IntPtr SendMessage(<br />
          IntPtr hWnd,<br />
          uint Msg,<br />
          IntPtr wParam,<br />
          IntPtr lParam);</p>
<p>        private const int WM_VSCROLL = 277;<br />
        private const int SB_LINEUP = 0;<br />
        private const int SB_LINEDOWN = 1;<br />
        private const int SB_TOP = 6;<br />
        private const int SB_BOTTOM = 7;</p>
<p>        public static void ScrollToBottom(this System.Windows.Forms.TextBoxBase tb)<br />
        {<br />
            SendMessage(tb.Handle, WM_VSCROLL, new IntPtr(SB_BOTTOM), new IntPtr(0));<br />
        }</p>
<p>        public static void ScrollToTop(this System.Windows.Forms.TextBoxBase tb)<br />
        {<br />
            SendMessage(tb.Handle, WM_VSCROLL, new IntPtr(SB_TOP), new IntPtr(0));<br />
        }</p>
<p>        public static void ScrollLineDown(this System.Windows.Forms.TextBoxBase tb)<br />
        {<br />
            SendMessage(tb.Handle, WM_VSCROLL, new IntPtr(SB_LINEDOWN), new IntPtr(0));<br />
        }</p>
<p>        public static void ScrollLineUp(this System.Windows.Forms.TextBoxBase tb)<br />
        {<br />
            SendMessage(tb.Handle, WM_VSCROLL, new IntPtr(SB_LINEUP), new IntPtr(0));<br />
        }</p>
<p>    }<br />
}<br />
[/code]</p>
<p>Usage is exactly the same:</p>
<p>[code]<br />
        private void anyTextBox_TextChanged(object sender, EventArgs e)<br />
        {<br />
            textLogMain.ScrollToBottom();<br />
        }<br />
[/code]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jakob</title>
		<link>http://bitmatic.com/c/implementing-a-scrolling-richtextbox/comment-page-1#comment-37</link>
		<dc:creator>Jakob</dc:creator>
		<pubDate>Tue, 30 Jun 2009 07:24:22 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=283#comment-37</guid>
		<description>I don&#039;t know anything about Silverlight, sorry....</description>
		<content:encoded><![CDATA[<p>I don&#8217;t know anything about Silverlight, sorry&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chakri</title>
		<link>http://bitmatic.com/c/implementing-a-scrolling-richtextbox/comment-page-1#comment-36</link>
		<dc:creator>chakri</dc:creator>
		<pubDate>Tue, 30 Jun 2009 06:19:46 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=283#comment-36</guid>
		<description>How this can be done in silverlight, i am having a web application developed in silverlight and i am using the third party control RichTextBox in my application, how can i implement the scrolling feature for RichTextBox, i included the third party control DLL in my appli</description>
		<content:encoded><![CDATA[<p>How this can be done in silverlight, i am having a web application developed in silverlight and i am using the third party control RichTextBox in my application, how can i implement the scrolling feature for RichTextBox, i included the third party control DLL in my appli</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry</title>
		<link>http://bitmatic.com/c/implementing-a-scrolling-richtextbox/comment-page-1#comment-35</link>
		<dc:creator>Barry</dc:creator>
		<pubDate>Mon, 22 Jun 2009 05:31:32 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=283#comment-35</guid>
		<description>Jeez how much clearer could he have made it...</description>
		<content:encoded><![CDATA[<p>Jeez how much clearer could he have made it&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Wob</title>
		<link>http://bitmatic.com/c/implementing-a-scrolling-richtextbox/comment-page-1#comment-38</link>
		<dc:creator>John Wob</dc:creator>
		<pubDate>Sat, 06 Jun 2009 16:37:32 +0000</pubDate>
		<guid isPermaLink="false">http://bitmatic.com/?p=283#comment-38</guid>
		<description>This code is very useful, i had no problems with my scrolling crap, but some people do not know how to use this so please explain better.</description>
		<content:encoded><![CDATA[<p>This code is very useful, i had no problems with my scrolling crap, but some people do not know how to use this so please explain better.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

