All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
几个比较有用的正则表达式_[PHP教程]
delphi滚动条组件(TScrollBar)使用方法
ASP.NET Remoting体系结构(四)
SQL命令大全--中文翻译_[SQL Server教程]
PHP5中的this,self和parent关键字详解_[PHP教程]
ASP.NET,2.0下的条件编译_[Asp.Net教程]
在ASP.NET,2.0中使用样式、主题和皮肤_.net资料_编程技术
具体实现 XML 的三种方式_[XML教程]
visual c++ MFC调试宏
最简单快速的Apache二级域名实现方法介绍_php资料_编程技术
Reading number is top 10 pictures
Desktop Wallpapers1
两个妞在等世界上最短的火车
Kim jong il's mistress, national beauty JinYuJi actor3
心有鱼而力不足
西游四格漫画(二)
Parking technology is great, that give you the keys can't stolen
Group of female porn in 《westwards》, uninhibited woman threatened to not the bottom line2
29 the belle stars after bath figure2
奇趣的世界记录2
A resort photographed beautiful young woman change clothes process vomiting blood1
Download software ranking
Tram sex maniac 2 (H) rar bag19
天龙八部十二宫服务端
徐若瑄成名作“魔鬼天使”
软件工程思想
双旗镇刀客B
The cock of the Grosvenor LTD handsome
双旗镇刀客A
C++教程第四版
都市狐狸姑娘传
虚拟机汉化软件
qq published in(发表于) 2014/7/11 9:20:15 Edit(编辑)
C#中的多媒体技术:文字处理

C#中的多媒体技术:文字处理

C#中的多媒体技术:文字处理

文字处理

在C#中可以通过Label控件、TextBox控件、窗体和PictureBox控件来显示文字。窗体和PictureBox控件主要是通过DrawString方法实现,而TextBox控件和Label控件是专门用来显示文字信息的。要想实现文字的滚动,可以通过将Label控件的Left、Top属性和Timer控件相结合,使Label控件每隔一段时间就移动一次位置,如果时间间隔合适,就可以实现Label控件中显示的文字滚动的效果。

示例

由左向右滚动的文字

本示例利用Label控件来实现文字的滚动。要实现文字由左向右滚动,网站源代码可以设置Label控件的Left属性,例如,“label1.Left = label1.Left + 50;”。

程序运行结果,如图1所示。



图1 滚动文字

程序开发步骤如下所示。

(1)创建一个项目,命名为27_01,设置默认窗体的Text属性为“滚动文字”。

(2)在窗体上添加两个Label控件,一个Timer控件,设置Timer控件的Interval属性为200。

(3)程序代码如下。

private void timer1_Tick(object sender, EventArgs e)

{

if (label1.Left < this.Width)

{

label1.Left = label1.Left + 50;

}

else if (label1.Left > -this.Width)

{

label1.Left = - label1.Width;

}

}

完整程序代码如下:

★ ★★★★Form1.cs窗体代码文件完整程序代码★★★★★

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace _7_01

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void timer1_Tick(object sender, EventArgs e)

{

if (label1.Left < this.Width)

{

label1.Left = label1.Left + 50;

}

else if (label1.Left > -this.Width)

{

label1.Left = - label1.Width;

}

}

}

}

★ ★★★★Form1.Designer.cs窗体设计文件完整程序代码网站源代码★★★★★

namespace _7_01

{

partial class Form1

{

///



/// 必需的设计器变量。

///


private System.ComponentModel.IContainer components = null;

///

/// 清理所有正在使用的资源。

///


/// 如果应释放托管资源,为 true;否则为 false。

protected override void Dispose(bool disposing)

{//本教程来自http://www.ISSTUDY.com

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

#region Windows 窗体设计器生成的代码

///

/// 设计器支持所需的方法 - 不要

/// 使用代码编辑器修改此方法的内容。

///


private void InitializeComponent()

{

this.components = new System.ComponentModel.Container();

this.timer1 = new System.Windows.Forms.Timer(this.components);

this.label1 = new System.Windows.Forms.Label();

this.SuspendLayout();

//

// timer1

//

this.timer1.Enabled = true;

this.timer1.Interval = 200;

this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

//

// label1

//

this.label1.AutoSize = true;

this.label1.Location = new System.Drawing.Point(78, 36);

this.label1.Name = "label1";

this.label1.Size = new System.Drawing.Size(137, 12);

this.label1.TabIndex = 0;

this.label1.Text = "吉林省明日科技欢迎您!";

//

// Form1

//本教程来自http://www.ISSTUDY.com

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

this.ClientSize = new System.Drawing.Size(315, 96);

this.Controls.Add(this.label1);

this.Name = "Form1";

this.Text = "滚动文字";

this.ResumeLayout(false);

this.PerformLayout();

}

#endregion

private System.Windows.Forms.Timer timer1;

private System.Windows.Forms.Label label1;

}

}

★ ★★★★Program.cs主程序文件完整程序代码★★★★★

using System;

using System.Collections.Generic;

using System.Windows.Forms;

namespace _7_01

{

static class Program

{

///

/// 应用程序的主入口点。

///


[STAThread]


添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.