日期:2014-05-17  浏览次数:21209 次

c# 中字幕滚动
form程序中 实现字幕上下连续滚动,要有电视字幕滚动的效果,求教?
 

------解决方案--------------------
web服务?
或是加个 可以写HTML的控件 我觉得..
------解决方案--------------------
用marquee标签
------解决方案--------------------
使用线程,每隔一段时间移动一下字幕的位置,然后重新绘制,基本思路是这样的。
在CodeProject上见过一个差不多的例子,我帮你找找看。
------解决方案--------------------
<marquee direction =left onmouseout ="this.start()" onmouseover ="this.stop()" style="width: 684px" >
欢迎您;</marquee>
------解决方案--------------------
做成一个用户控件,需要一个Label、Timer基础控件,让计时器不断移动Label的位置就可以了。
1using System;
 2using System.Collections.Generic;
 3using System.ComponentModel;
 4using System.Drawing;
 5using System.Data;
 6using System.Text;
 7using System.Windows.Forms;
 8
 9namespace pcd.WinControl
10{
11 public partial class LabelTextMoving : UserControl
12 {
13 public LabelTextMoving()
14 {
15 InitializeComponent();
16 }
17
18 private void timer1_Tick(object sender, EventArgs e)
19 {
20 if (labMsg.Location.X < 0 && Math.Abs(labMsg.Location.X) - labMsg.Width >= 0)
21 {
22 labMsg.Location = new Point(panel1.Width, labMsg.Location.Y);
23 return;
24 }
25 labMsg.Location = new Point(labMsg.Location.X - 5, labMsg.Location.Y);
26 }
27
28
29 Properties#region Properties
30 [Category("Appearance"),
31 Description("Label前景色")]
32 public System.Drawing.Color LabelForeColor
33 {
34 get { return labMsg.ForeColor; }
35 set { labMsg.ForeColor = value; }
36 }
37
38
39
40 [Category("Appearance"),
41 Description("LabelText")]
42 public string LabelText
43 {
44 get { return labMsg.Text; }
45 set
46 {
47
48 labMsg.Text = value;
49 if (value == "")
50 timer1.Enabled = false;
51 else timer1.Enabled = true;
52 }
53 }
54
55 #endregion
56 }
57}
58


出自:http://www.cnblogs.com/jdmei520/archive/2009/05/27/1490814.html
------解决方案--------------------
拉个WebBrowser控件 使用THML的marquee
------解决方案--------------------
学习一下。关注一下。
------解决方案--------------------
学习了!(*^__^*) 嘻嘻……
------解决方案--------------------
这正是我要找的,谢谢。
------解决方案--------------------
看看这篇:
http://www.codeproject.com/KB/GDI-plus/StarWarsStyleTextScroller.aspx
效果:

这个实现的效果比你说的还要复杂,找出关键代码就可以用到你的项目中了。