winform中有没有类似marquee这样的方法?

解决方案 »

  1.   

    这个最简单的办法就是放一个WebBrowser 然后拼HTML...
      

  2.   

    我想到的 最多是控件的位置移动比如你定义一个lable Text内容是歌词 ,然后循环+延迟 移动lable 或者替换Text的内容 好象没有现成的控件可以做到html marquee的功能
      

  3.   


    这个效果好,容易实现。显示一个固定的HTML文件,然后加入字幕的JS。
      

  4.   

    我是想在winform中实现字幕滚动效果,没有个思路,用到timer控件
      

  5.   

    没有听说过,winform中也可以有吗?
      

  6.   

    先添加控件。然后加载一个HTML页。很简单。你试一下。
      

  7.   

    简单 
       //假设你添加了个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程序吗!
           对不对?
      

  8.   

    老大,杀鸡用得着牛刀么?
    放个label,加个定时器,移动label的位置就行了,连线程都不用加。如果是wpf,那就更简单了,wpf本身就支持动画。
      

  9.   

    楼上正解。winform本身比asp.net强大千倍。asp.net,winform,wpf三样都不精通的路过。
      

  10.   

     简单来说 所有的控件  不过是在Winform的大环境下 绘制出来的  使用好GDI+ ,xp以下的任何操作系统(以上使用WPF) ,你都可以任意控制窗体控件!
      别老专注于Web这种外围技术,了解低层才是王道口牙!!!!!!!!!!!
      

  11.   

    using System;
    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;
            }
        }
    }
      

  12.   

    给你写了一个纯线程控制的类,要用的地方new一个就是了,不过不要的时候记得一定要Stop
      

  13.   

    是这个类吗class Marquee : PictureBox
    看不明白,能不能解释一下,
      

  14.   

    用个图片框  自己用GDI+ 把文字画上去呗。
      

  15.   

    对  用GDI画上去的  也能达到滚动的效果
      

  16.   

    添加timer控件  tick事件中 设置label的location
      

  17.   

    http://bbs.msproject.cn/  找TransplarentLabel 
      

  18.   

    加个timer控件  定时激发执行click操作 操作为控制label坐标
      

  19.   

    HTML Renderer
      

  20.   

    补充下   需要控件想拖一个statusScript控件   再拖一个time控件
    然后激活tmie事件
    代码如下
         private void timer1_Tick(object sender, EventArgs e)
            {
                TimerYingYong();
            }         void TimerYingYong()
            {
                this.statuslblBiaoYu.Text = Model.statusBiaoYu.BY("欢迎进入!!!");
                this.statuslblTime.Text = "当前系统时间:  " + Model.statusBiaoYu.Time();        }
    你试下
      

  21.   

      向左滚动:
      lblShowInfo.Left := lblShowInfo.Left - 8;
      if lblShowInfo.Left + lblShowInfo.Width < Panel1.Left then
        lblShowInfo.Left := Panel1.Left + Panel1.Width;
      

  22.   


    是的,new完调用start,用的是线程+gdi+,不要用label移动,会闪的,也不要用timer,因为会和其它部分互相影响
      

  23.   

    有道理  我怎么没想到   以前我都是用TIME控件来做
      

  24.   

    这个是不是还要加什么命名空间啊,我怎么打不出Model.statusBiaoYu.BY("欢迎进入!!!"); 
    我这知道statusBiaoYu是statusScrip的属性Text,可是Medel是什么?有知道的帮解释一下
      

  25.   

    如果要求很好,最好用GDI+,如果要求效果不高,则用label+Timer完全可以满足
      

  26.   

    给你一个按像素滚动的例子 http://download.csdn.net/source/879247
      

  27.   


    statuslblBiaoYu这个是我给控件重新命的名字  
      

  28.   

    我这里Model打不出来,是什么问题?
      

  29.   

    我倒,给你把代码都写着这么清楚了,测试效果很好,new一个就能出来了,还在问别人怎么做