滚动标题栏中的文字C# [英] scrolling text in title bar C#
本文介绍了滚动标题栏中的文字C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我开发了一个Windows窗体应用程序。我需要滚动标题栏中的文字。表格的标题从右到左滚动..我不知道如何开始?请让我知道我从哪里开始.. ????
- 谢谢
I''ve developed a Windows Form application. I need to scroll the text in Title bar. Where title of the form Scrolls from right to left.. I don''t know how to start?? Please let me know Where can I get started..????
- THANKS
推荐答案
private void StartScroll()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder(textBox1.Text +);
while(true)
{
char ch = sb [sb.Length - 1];
sb.Remove(sb.Length - 1,1);
sb.Insert(0,ch);
label1.Text = sb.ToString();
label1 .Refresh();
System.Threading.Thread.Sleep(100);
}
}
你将不得不在winforms中使用计时器来实现滚动
private void StartScroll()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder(textBox1.Text + " ");
while (true)
{
char ch = sb[sb.Length - 1];
sb.Remove(sb.Length - 1, 1);
sb.Insert(0, ch);
label1.Text = sb.ToString();
label1.Refresh();
System.Threading.Thread.Sleep(100);
}
}
you will have to use timers in winforms to implement scrolling
使用以下来源的代码:
WinForm Extended [ ^ ]
Use code from following source:
WinForm Extended[^]
其他解决方案将使用前面建议的计时器:
http://www.c-sharpcorner .com / blogs / 6321 / scrolling-title-in-windows-form.aspx [ ^ ]
Other solution will be use of timer as suggested earlier:
http://www.c-sharpcorner.com/blogs/6321/scrolling-title-in-windows-form.aspx[^]
这篇关于滚动标题栏中的文字C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文