string strText = "";
string strData = "";
private void ScrollingForm_Load(object sender, EventArgs e)
{
strText = textBox1.Text;
}
private void timer1_Tick(object sender, EventArgs e)
{
timer1.Enabled = false;
for (int k = 1; k < strData.Length; k++)
{
textBox1.Text = strData.Substring(k);
textBox1.Refresh();
System.Threading.Thread.Sleep(500);
Application.DoEvents();
}
timer1.Enabled = true;
}
private void ScrollingForm_Activated(object sender, EventArgs e)
{
for (int i = 0; i <= strText.Length; i++)
{
if (i == strText.Length)
{
textBox1.Text = strText.Substring(i) + string.Format("{0, -30}", "") + strText.Substring(0);
strData = textBox1.Text;
}
else
textBox1.Text = strText.Substring(i);
textBox1.Refresh();
System.Threading.Thread.Sleep(500);
Application.DoEvents();
}
timer1.Interval = 1000;
timer1.Enabled = true;
}
'C#' 카테고리의 다른 글
[C#]카운트다운 예제 (0) | 2018.05.16 |
---|---|
[C#]TextBox Caret Hide 예제 (0) | 2018.04.20 |
[C#]PC 전원종료 시간 구하기 예제 (0) | 2018.01.25 |
[C#]클릭 시간 확인 예제 (0) | 2018.01.24 |
[C#]실행 파일 이름 구하기 예제 (0) | 2017.12.07 |