winform中有没有类似marquee这样的方法?
解决方案 »
- ThreadStart启动一个线程用于循环操作,ManualResetEvent控制信号,停止循环时,系统经常会出现假死现象
- 连接已打开
- Visual C#上传文件,总是提示404错误
- 回答一个dotnetbar简单的问题就能得100分
- 关于DatagridView 问题(windows)--在线等 urgent!!!!!!!!!!
- UdpClient如果传输文件?
- 诚密.NET高手,帮帮小妹妹我.急啊!
- 为什么CDO发送邮件总是不成功,解决100分,原代码如下,这边通过代理出去的
- []内的内容。。。内详!!!!![ClassInterface(ClassInterfaceType.AutoDual)]
- 不能调用类型参数的静态方法,如何实现类似功能?
- 请教一下全局钩子,DEMO运行通过,但加个FORM就不行了
- 当鼠标点击按钮时如何让calender控件在按钮的下方显示
这个效果好,容易实现。显示一个固定的HTML文件,然后加入字幕的JS。
//假设你添加了个timer
//再假设你有个lable 叫label5
location属性 可以得到一个point 对象
t.X 代表横坐标, t.Y代表纵坐标。
其他自己想咯!!!!!
直接改变t的 x和 y 你可以得到任何移动效果!
private void timer1_Tick(object sender, EventArgs e)
{
Point t = this.label5.Location;
t.X;
t.Y;
} 被GDI+折磨了1个月的人飘过! 还有高级版的!
//this 指的是当前窗体实例
Graphics g= this.CreateGraphics();
有了这个 g 你干什么都行 相比web Winform的自由度更广泛,毕竟浏览器也是个Winform程序吗!
对不对?
放个label,加个定时器,移动label的位置就行了,连线程都不用加。如果是wpf,那就更简单了,wpf本身就支持动画。
别老专注于Web这种外围技术,了解低层才是王道口牙!!!!!!!!!!!
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;namespace WindowsApplication62
{
public partial class Form1 : Form
{
Button B = new Button();
Button B2 = new Button();
Marquee M = null; public Form1()
{
InitializeComponent(); B.Parent = this;
B.Text = "开始";
B.Click += new EventHandler(B_Click);
B2.Parent = this;
B2.Text = "停止";
B2.Click += new EventHandler(B2_Click);
B2.Location = Point.Add(B.Location, new Size(B.Width, 0));
} void B_Click(object sender, EventArgs e)
{
M = new Marquee();
M.Start(this, "ABCDEFG", Point.Add(B.Location, new Size(0, B.Height)), new Size(100, 100));
} void B2_Click(object sender, EventArgs e)
{
M.Stop();
M.Dispose();
M = null;
}
} class Marquee : PictureBox
{
int Y = 0;
String DrawText = String.Empty;
Bitmap OrgBmp = null;
delegate void SetImage(Image NewImage); public void Start(Form Parent, String Text, Point Location, Size RectSize)
{
this.Parent = Parent;
this.DrawText = Text;
this.Location = Location;
this.Size = RectSize;
Y = RectSize.Height;
this.Visible = true;
this.Image = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height);
Graphics G = Graphics.FromImage(this.Image);
G.FillRectangle(new SolidBrush(this.BackColor), this.ClientRectangle);
G.Dispose();
OrgBmp = new Bitmap(this.Image);
Thread T = new Thread(new ThreadStart(DoDraw));
T.Start();
} public void Stop()
{
this.Visible = false;
} void DoDraw()
{
while (this.Visible)
{
Bitmap CacheBmp = new Bitmap(OrgBmp);
Graphics G = Graphics.FromImage(CacheBmp);
G.DrawString(DrawText, new Font("宋体", 10), new SolidBrush(Color.Black), new PointF(0, Y = Y-- < 0 ? this.Size.Height : Y));
G.Dispose();
this.Invoke(new SetImage(DoSetImage), new Object[] { CacheBmp });
Thread.Sleep(50);
}
} void DoSetImage(Image NewImage)
{
this.Image = NewImage;
}
}
}
看不明白,能不能解释一下,
然后激活tmie事件
代码如下
private void timer1_Tick(object sender, EventArgs e)
{
TimerYingYong();
} void TimerYingYong()
{
this.statuslblBiaoYu.Text = Model.statusBiaoYu.BY("欢迎进入!!!");
this.statuslblTime.Text = "当前系统时间: " + Model.statusBiaoYu.Time(); }
你试下
lblShowInfo.Left := lblShowInfo.Left - 8;
if lblShowInfo.Left + lblShowInfo.Width < Panel1.Left then
lblShowInfo.Left := Panel1.Left + Panel1.Width;
是的,new完调用start,用的是线程+gdi+,不要用label移动,会闪的,也不要用timer,因为会和其它部分互相影响
我这知道statusBiaoYu是statusScrip的属性Text,可是Medel是什么?有知道的帮解释一下
statuslblBiaoYu这个是我给控件重新命的名字