在状态栏中滚动文本 [英] Scrolling Text in status bar

查看:73
本文介绍了在状态栏中滚动文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望文本在状态栏中滚动文本,但无法执行!!实际上我是从dadtabse n中选择数据,然后在滚动模式下显示在状态栏中,但是我既无法显示文本也不可以滚动任何建议!

i want text to scroll text in status bar but not able to do!!!actually im picking data from dadtabse n then showing in status bar in scrolling mode but im neither able to show text nor scroll it any suggestions!!

推荐答案

我不知道网页中的状态栏.但是在Windows窗体中,状态栏本身不足以显示消息.假设我要显示消息"Process Completed",程序员可以编写此行-StatusBar.Text ="Process Completed".
但这不会在用户界面中显示该消息.一个需要做的就是将控件Lable添加到StatusBar,然后分配Label的Text属性-Lable1.Text ="Process Completed".

就滚动文本而言,您需要定期更改状态栏中标签的位置(Control.Left属性).但这应该在另一个线程上完成,以便其位置与UI同步.您可以使用.Net 3.0中提供的BackGroundThreadWorker来完成此操作.如果您使用的是旧版本,则需要在显式创建的线程中执行此操作
I don''t know about the status bar in web page. But In windows forms the status bar itself is not sufficient enough to show up the messages. Say if I want to show the message "Process Completed", programmer may write this line - StatusBar.Text = "Process Completed".
But this will not show the message in the UI. What one need to do is add the control Lable to the StatusBar then assign the Text property of the Label - Lable1.Text = "Process Completed".

As far as scrolling text is concerned, you need to change the location (Control.Left Property) of label in the status bar periodically. But this should be done on another thread so that its location syncs with UI. You can do it with BackGroundThreadWorker provided in .Net 3.0. If you are using the older version, you need to do it in a thread created explicitly


感谢所有回复!
我很简单地得到了答案,我们可以删除字符串的第一个字符并将其添加到末尾,然后继续使字符串以滚动方式出现:-\
我用StringBuilder代替了字符串

代码段:

在计时器控件的滴答事件中,我写了以下几行;

char ch = sb [1];
sb.remove(1,1);
sb.insert(sb.length,ch);
toolStripLabel.text = sb.tostring();

我在加载函数中声明了System.text.StringBuilder的sb对象,并为其分配了文本!
sb = new StringBuilder(toolStripStatusLabel1.Text +");

toolStripStatusLabel1是状态条上的标签

是在VS 2008中完成的
thanks for all replies!!!
i got the answer n its vry simple we can do it by removing first character of the string and add it in the end, continuing this makes string appear in a scrolling manner :-\
I used StringBuilder instead of string

Code Snippet:

on tick event of timer control i wrote following lines;

char ch = sb[1];
sb.remove(1,1);
sb.insert(sb.length,ch);
toolStripLabel.text = sb.tostring();

i declared sb object of System.text.StringBuilder in load function and assign it a text!!!

sb = new StringBuilder(toolStripStatusLabel1.Text + " ");

toolStripStatusLabel1 is the label over status strip

Did this in VS 2008


这篇关于在状态栏中滚动文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆