.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

How to Scroll a user control along with richtextbox?

Posted By: Dhilip.R     Posted Date: June 02, 2011    Points:5   Category :C#
Hi,

I have a richtextbox and I added a user control in it. now my problem is when the text length is increased the vertical scroll bar will appeared and the text will scrolled up. But the control I added is not scrolled.

How can I scroll the control along with the richtextbox?

Note: I need sample code in C#

Thanks & Regards
Dhilip.R

Responses
Author: Gowthammanju             
Posted Date: June 03, 2011     Points: 20   

Kindly check out the following links which might help u



http://www.codeproject.com/KB/cs/scrollingTextbox.aspx

http://www.codeproject.com/KB/vb/VbNetScrolling.aspx


Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: Dhilip.R             
Posted Date: June 03, 2011     Points: 20   

Hi, Gowthammanju

That thread you posted only scrolling the text. by default that will happen. but my query is scroll the newly added control with richtextbox.

Thanks and regards
Dhilip.R

Author: sri             
Posted Date: June 03, 2011     Points: 20   

<asp:richTextBox ID="txtpayslip" runat="server" Width="668px" CssClass="scroltxt">


.scrolltxt{
overflow:scroll;
}

Author: sri             
Posted Date: June 03, 2011     Points: 20   

<asp:richTextBox ID="txtpayslip" runat="server" Width="668px" CssClass="scroltxt">

////in cssstyle sheet

.scrolltxt{
overflow:scroll;
}

Author: Gowthammanju             
Posted Date: June 04, 2011     Points: 20   

Hmmm Dhilip.R !
u can set property to as
(style=overflow:auto)
which returns a scroll in ur textbox






Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: sri             
Posted Date: June 04, 2011     Points: 20   

cssclass property..
add scroltxt style in stylsheet

Author: Dhilip.R             
Posted Date: June 06, 2011     Points: 20   

Hi,Responds

Thanks for ur reply. i need code for windows application richtextbox.

I tried and most probably done with the following code

private void receiveChatMessage_VScroll(object sender, EventArgs e)
{
int i = 0;
Point pt = new Point();
//Use this API for get the scroll position
SendMessage(this.richTextBox.Handle, EM_GETSCROLLPOS, 0, ref pt);
foreach (Control c in richTextBox.Controls)
{
//The cLoc is the list of Y position of the controls when it added in the richtextbox
int b = Convert.ToInt32(cLoc[i]);
c.Location = new Point(c.Location.X, -pt.Y + b);
i += 1;
}
richTextBox.Refresh();
}

Thanks & Regards
Dhilip.R

Author: Dhilip.R             
Posted Date: June 07, 2011     Points: 20   

w



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend