C# WinFrom如果让TextBox实现文字滚动效果(新手提问) 如题.. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 对于在窗体上滚动输出文字,可以用TextBox, 设置它的SelectionStart属性,然后调用ScrollToCaret方法。为了持续滚动,你可以使用一个定时器。以下是个例子:public partial class Form1 : Form { public Form1() { InitializeComponent(); this.timer1.Interval = 1000; this.timer1.Tick += new EventHandler(timer1_Tick); this.timer1.Start(); } void timer1_Tick(object sender, EventArgs e) { ScrollText(); } int rowindex = 0; int rowcount = 0; private void Form1_Load(object sender, EventArgs e) { rowcount = this.textBox1.GetLineFromCharIndex(this.textBox1.TextLength) +1; } private void ScrollText() { this.textBox1.SelectionStart = this.textBox1.GetFirstCharIndexFromLine(rowindex); this.textBox1.ScrollToCaret(); rowindex++; if (rowindex == rowcount) { rowindex = 0; } } } 菜鸟对“编译”这个词傻傻分不清楚 请教个vs中的数据库的问题 C# 绘图求救 创建一个pocket pc 2003 SE 程序如何连接SQL-Server2005 将C++中函数导入到C#中参数是数组怎么办 C#执行CMD的命令有权限问题? 关于几个C#的问题 VS2005TS的团队特性?? 如何生成。snk文件。。还有GUID如何使用。。我把代码PASTE后,总提示错误 关于泛型调用的问题 oracle 将表名作为参数 求教:有一个Student类,从SQLSERVER数据库中读取多个值包括名字班级等等
{
public Form1()
{
InitializeComponent();
this.timer1.Interval = 1000;
this.timer1.Tick += new EventHandler(timer1_Tick);
this.timer1.Start();
} void timer1_Tick(object sender, EventArgs e)
{
ScrollText();
}
int rowindex = 0;
int rowcount = 0;
private void Form1_Load(object sender, EventArgs e)
{
rowcount = this.textBox1.GetLineFromCharIndex(this.textBox1.TextLength) +1; }
private void ScrollText()
{
this.textBox1.SelectionStart = this.textBox1.GetFirstCharIndexFromLine(rowindex);
this.textBox1.ScrollToCaret();
rowindex++;
if (rowindex == rowcount)
{
rowindex = 0;
}
}
}