使ç¨äºä¸¤ä¸ªLable1ã两个textBoxãä¸ä¸ªButtonãä¸ä¸ªtimeræ§ä»¶
private System.Windows.Forms.Button btnStringRoll;
private System.Windows.Forms.TextBox tbTextRoll;
private System.Windows.Forms.TextBox tbTextAutoRoll;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
Form1.cs:代ç
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 代ç ç»ä¹ 1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
/// <summary>
/// tbTextRoll.Text æ¾ç¤º ç¹å»ä¸æ¬¡æé®ï¼æ»å¨ä¸ä¸ªå符
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnStringRoll_Click(object sender, EventArgs e)
{
string str = tbTextRoll.Text;
char first = str[0];
string surplus = str.Substring(1); //ååºå©ä½çå符
tbTextRoll.Text = surplus + first;
}
/// <summary>
/// tbTextAutoRoll.Text è¿è¡å°± èªå¨ æ»å¨ä¸ä¸ªå符
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void timer1_Tick(object sender, EventArgs e)
{
string str = tbTextAutoRoll.Text;
char first = str[0];
string surplus = str.Substring(1); //ååºå©ä½çå符
tbTextAutoRoll.Text = surplus + first;
}
private void Form1_Load(object sender, EventArgs e)
{
this.timer1.Start();
timer1.Interval = 300; //äºä»¶é´éæ¶é´
}
}
}
Form1.Designer.cs
namespace 代ç ç»ä¹ 1
{
partial class Form1
{
/// <summary>
/// å¿
éç设计å¨åéã
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// æ¸
çæææ£å¨ä½¿ç¨çèµæºã
/// </summary>
/// <param name="disposing">å¦æåºéæ¾æ管èµæºï¼ä¸º trueï¼å¦å为 falseã</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows çªä½è®¾è®¡å¨çæç代ç
/// <summary>
/// 设计å¨æ¯ææéçæ¹æ³ - ä¸è¦
/// 使ç¨ä»£ç ç¼è¾å¨ä¿®æ¹æ¤æ¹æ³çå
容ã
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.btnStringRoll = new System.Windows.Forms.Button();
this.tbTextRoll = new System.Windows.Forms.TextBox();
this.tbTextAutoRoll = new System.Windows.Forms.TextBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btnStringRoll
//
this.btnStringRoll.Font = new System.Drawing.Font("å®ä½", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnStringRoll.Location = new System.Drawing.Point(12, 44);
this.btnStringRoll.Name = "btnStringRoll";
this.btnStringRoll.Size = new System.Drawing.Size(90, 41);
this.btnStringRoll.TabIndex = 0;
this.btnStringRoll.Text = "ç¹å»ä¸æ¬¡\r\næ»å¨ä¸æ¬¡ ";
this.btnStringRoll.UseVisualStyleBackColor = true;
this.btnStringRoll.Click += new System.EventHandler(this.btnStringRoll_Click);
//
// tbTextRoll
//
this.tbTextRoll.Font = new System.Drawing.Font("å®ä½", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tbTextRoll.Location = new System.Drawing.Point(108, 53);
this.tbTextRoll.Multiline = true;
this.tbTextRoll.Name = "tbTextRoll";
this.tbTextRoll.Size = new System.Drawing.Size(293, 27);
this.tbTextRoll.TabIndex = 1;
this.tbTextRoll.Text = "è¿æ¯æ»å¨çå符ï¼æ»å¨æ¹åæ¯èªå³åå·¦!";
//
// tbTextAutoRoll
//
this.tbTextAutoRoll.Font = new System.Drawing.Font("å®ä½", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tbTextAutoRoll.Location = new System.Drawing.Point(86, 166);
this.tbTextAutoRoll.Multiline = true;
this.tbTextAutoRoll.Name = "tbTextAutoRoll";
this.tbTextAutoRoll.Size = new System.Drawing.Size(296, 28);
this.tbTextAutoRoll.TabIndex = 3;
this.tbTextAutoRoll.Text = "è¿æ¯æ»å¨çå符ï¼æ»å¨æ¹åæ¯èªå³åå·¦ï¼";
//
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("å®ä½", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(129, 143);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(199, 20);
this.label1.TabIndex = 4;
this.label1.Text = "tbTextAutoRoll.Text";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("å®ä½", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(142, 30);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(159, 20);
this.label2.TabIndex = 5;
this.label2.Text = "tbTextRoll.Text";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(413, 269);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.tbTextAutoRoll);
this.Controls.Add(this.tbTextRoll);
this.Controls.Add(this.btnStringRoll);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnStringRoll;
private System.Windows.Forms.TextBox tbTextRoll;
private System.Windows.Forms.TextBox tbTextAutoRoll;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
}
}
温馨提示:内容为网友见解,仅供参考