嘿嘿,先说下要求
我创建一个窗口,然后窗口上出现几个字,比如 GAME OVER,能显示汉字更好GAME OVER 从窗口的左边往右边移动,移动到底的时候,GAME OVER消失,又在中间显示GAME OVER没有鼠标点击等触发事件,程序启动后就直接运行大侠们,给个代码吧,这对我很重要

解决方案 »

  1.   

    一个定时器,一个label,窗体加载后就开启定时器,定时器内设置label.Right += 步进单位
    当label.Left < 窗体width的时候,设置到中间位置。然后停止timer.
      

  2.   

    http://topic.csdn.net/u/20090606/10/5fc58b85-d448-4449-a46e-feb3fd9b0bcc.html
      

  3.   

    新建一个Form,添加一个button1,贴上以下代码,绑上button1的click事件到button1_clickusing 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 WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private string _displaytext = "GAME OVER";
            private Font _font = new Font(new FontFamily("Arial Unicode MS"), 30, FontStyle.Bold);
            private Brush _textcolor = Brushes.Red;
            private int _sleep = 40;
            private int _skippx = 3;
            private SizeF _textsize = Size.Empty;        private Image DrawText(int x, int y, int width, int height, Color background)
            {
                Bitmap b = new Bitmap(width, height);
                Graphics g = Graphics.FromImage(b);
                g.Clear(background);            if (_textsize.IsEmpty)
                {
                    _textsize = g.MeasureString(_displaytext, _font);
                }            g.DrawString(_displaytext, _font, _textcolor, (float)x, (float)y);
                g.Save();
                g.Dispose();
                return b;
            }        private delegate Size D_GetControlSize(Control c);
            private delegate Color D_GetControlBackGroundColor(Control c);
            private delegate void D_SetFormBackImage(Form f, Image img);        private Size GetControlSize(Control c)
            {
                return c.Size;
            }        private Color GetControlBackGroundColor(Control c)
            {
                return c.BackColor;
            }        private void SetFormBackImage(Form f, Image img)
            {
                f.BackgroundImage = img;
            }        private void PlayText(object frm)
            {
                if (frm == null || !(frm is Form))
                    return;
                Form f = (Form)frm;            Size size = (Size)f.Invoke(new D_GetControlSize(GetControlSize), f);
                Color backcolor = (Color)f.Invoke(new D_GetControlBackGroundColor(GetControlBackGroundColor), f);            D_SetFormBackImage setImage = new D_SetFormBackImage(SetFormBackImage);            for (int i = 0; i < size.Width; i += _skippx)
                {
                    f.Invoke(setImage, f, DrawText(i, (size.Height - (int)_textsize.Height) / 2, size.Width, size.Height, backcolor));
                    Thread.Sleep(_sleep);
                }            f.Invoke(setImage, f, DrawText((size.Width - (int)_textsize.Width) / 2, (size.Height - (int)_textsize.Height) / 2, size.Width, size.Height, backcolor));        }        private void button1_Click(object sender, EventArgs e)
            {
                Thread t = new Thread(new ParameterizedThreadStart(PlayText));
                t.Start(this);
            }
        }
    }
      

  4.   

    你娃娃,button不就要点击啊我需求是自启动,嘿嘿,去看看1楼上的timer
      

  5.   

    那么就劳烦您把button1里的2行代码放到Form_Load里去,
    我无聊之下给你写的代码无法完全满足您的要求真是对不起了,我错了,浪费了你时间。
      

  6.   

    用个lable一定时间往某个方向移动应该就可以了
      

  7.   

    3楼别激动,嘿嘿,在看代码之前,偶还不晓得有load事件哈哈,嘿嘿