Hello Philip,
There is no telerik control that does this, but i have prepared a CustomRadTextBoxControl that will do this, please see the following example, it should help you accomplish your task:
using
System;
using
System.Windows.Forms;
using
Telerik.WinControls.UI;
public
partial
class
Form1 : Form
{
ScrollableRadTextBox radTextBox1 =
new
ScrollableRadTextBox();
public
Form1()
{
InitializeComponent();
}
protected
override
void
OnLoad(EventArgs e)
{
base
.OnLoad(e);
radTextBox1.Dock = DockStyle.Top;
this
.Controls.Add(radTextBox1);
radTextBox1.Text =
"This is a test of the emergency broadcast systems"
;
radTextBox1.StartScrolling(20);
var stopButton =
new
RadButton();
stopButton.Text =
"Stop"
;
this
.Controls.Add(stopButton);
stopButton.Dock = DockStyle.Bottom;
stopButton.Click +=
new
EventHandler(stopButton_Click);
var startButton =
new
RadButton();
startButton.Text =
"Start"
;
this
.Controls.Add(startButton);
startButton.Dock = DockStyle.Bottom;
startButton.Click +=
new
EventHandler(startButton_Click);
}
void
stopButton_Click(
object
sender, EventArgs e)
{
radTextBox1.EndScrolling();
}
void
startButton_Click(
object
sender, EventArgs e)
{
radTextBox1.StartScrolling(20);
}
}
public
class
ScrollableRadTextBox : RadTextBox
{
private
Timer scrollTimer =
new
Timer();
private
string
currentText;
public
override
string
ThemeClassName
{
get
{
return
typeof
(RadTextBox).FullName;
}
}
public
ScrollableRadTextBox()
:
base
()
{
scrollTimer.Interval = 200;
}
private
void
ScrollText(
int
noCharacters)
{
if
(
this
.Text.Length == 0 ||
this
.Text.Length < noCharacters)
{
return
;
}
var pos = 0;
currentText = Text;
var tempText = currentText +
" "
+ currentText;
scrollTimer.Tick +=
delegate
{
if
(pos - 1 > currentText.Length) pos = 0;
Text = tempText.Substring(pos++, noCharacters);
};
scrollTimer.Start();
}
public
void
StartScrolling(
int
noCharacters)
{
this
.ScrollText(noCharacters);
}
public
void
EndScrolling()
{
scrollTimer.Stop();
this
.Text = currentText;
}
}
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga