这个嘛……楼下的上,俺要睡觉了(提示:用GDI+,Graphics.DrawImage将你PictureBox上面的Image截取部分进行显示,随着时间推移截取不同的部分)Aman……

解决方案 »

  1.   

    namespace WindowsApplication1
    {
      /// <summary>
      /// Form1 的摘要说明。
      /// </summary>
      public class Form1 : System.Windows.Forms.Form
      {
        private System.Windows.Forms.Timer timer1;
        private System.Windows.Forms.PictureBox pictureBox1;
        private System.ComponentModel.IContainer components;    public Form1()
        {
          //
          // Windows 窗体设计器支持所必需的
          //
          InitializeComponent();      //
          // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
          //
        }    /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        protected override void Dispose( bool disposing )
        {
          if( disposing )
          {
            if (components != null) 
            {
              components.Dispose();
            }
          }
          base.Dispose( disposing );
        }    #region Windows Form Designer generated code
        /// <summary>
        /// 设计器支持所需的方法 - 不要使用代码编辑器修改
        /// 此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
          this.components = new System.ComponentModel.Container();
          System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
          this.timer1 = new System.Windows.Forms.Timer(this.components);
          this.pictureBox1 = new System.Windows.Forms.PictureBox();
          this.SuspendLayout();
          // 
          // timer1
          // 
          this.timer1.Enabled = true;
          this.timer1.Interval = 10;
          this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
          // 
          // pictureBox1
          // 
          this.pictureBox1.Image = ((System.Drawing.Bitmap)(resources.GetObject("pictureBox1.Image")));
          this.pictureBox1.Location = new System.Drawing.Point(5, 80);
          this.pictureBox1.Name = "pictureBox1";
          this.pictureBox1.Size = new System.Drawing.Size(16, 16);
          this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
          this.pictureBox1.TabIndex = 0;
          this.pictureBox1.TabStop = false;
          // 
          // Form1
          // 
          this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
          this.ClientSize = new System.Drawing.Size(377, 193);
          this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                          this.pictureBox1});
          this.Name = "Form1";
          this.Text = "Form1";
          this.ResumeLayout(false);    }
        #endregion    /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main() 
        {
          Application.Run(new Form1());
        }    private void timer1_Tick(object sender, System.EventArgs e)
        {
          pictureBox1.Left = pictureBox1.Left + 1;
          if(pictureBox1.Left >= this.Width)
            pictureBox1.Left = 0;
        }
      }
    }
      

  2.   

    我改进了一下你看如何?
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;namespace picmove
    {
    /// <summary>
    /// Form1 的摘要说明。
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
    private System.Windows.Forms.Timer timer1;
    private System.Windows.Forms.PictureBox pictureBox1;
    private System.Windows.Forms.PictureBox pictureBox2;
    private System.ComponentModel.IContainer components; public Form1()
    {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    pictureBox2.Left=-(this.Width-pictureBox1.Right+pictureBox2.Width);
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if (components != null) 
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    }#region Windows Form Designer generated code
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    this.components = new System.ComponentModel.Container();
    System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
    this.timer1 = new System.Windows.Forms.Timer(this.components);
    this.pictureBox1 = new System.Windows.Forms.PictureBox();
    this.pictureBox2 = new System.Windows.Forms.PictureBox();
    this.SuspendLayout();
    // 
    // timer1
    // 
    this.timer1.Enabled = true;
    this.timer1.Interval = 10;
    this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
    // 
    // pictureBox1
    // 
    this.pictureBox1.Image = ((System.Drawing.Bitmap)(resources.GetObject("pictureBox1.Image")));
    this.pictureBox1.Location = new System.Drawing.Point(64, 8);
    this.pictureBox1.Name = "pictureBox1";
    this.pictureBox1.Size = new System.Drawing.Size(256, 256);
    this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
    this.pictureBox1.TabIndex = 0;
    this.pictureBox1.TabStop = false;
    // 
    // pictureBox2
    // 
    this.pictureBox2.Image = ((System.Drawing.Bitmap)(resources.GetObject("pictureBox2.Image")));
    this.pictureBox2.Location = new System.Drawing.Point(-256, 8);
    this.pictureBox2.Name = "pictureBox2";
    this.pictureBox2.Size = new System.Drawing.Size(256, 256);
    this.pictureBox2.TabIndex = 1;
    this.pictureBox2.TabStop = false;
    // 
    // Form1
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(400, 277);
    this.Controls.AddRange(new System.Windows.Forms.Control[] {
      this.pictureBox2,
      this.pictureBox1});
    this.Name = "Form1";
    this.Text = "Form1";
    this.ResumeLayout(false); }
    #endregion /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main() 
    {
    Application.Run(new Form1());
    } private void timer1_Tick(object sender, System.EventArgs e)
    {
    pictureBox1.Left = pictureBox1.Left + 1;
    pictureBox2.Left = pictureBox2.Left + 1;
    if(pictureBox1.Left >= this.Width)
    pictureBox1.Left =-(this.Width-pictureBox2.Right+pictureBox1.Width);
    if(pictureBox2.Left >= this.Width)
    pictureBox2.Left =-(this.Width-pictureBox1.Right+pictureBox2.Width); }
    }
    }
      

  3.   

    同意楼上的,
    你再试一试用它的size的初始化。
    ....
      

  4.   

    另一种思路:一个Panel,两个PictureBox,一个Timer
    在Panel中按时不停的改变PictureBox的Left值,并使其首尾相连,即可实现要求功能。
    代码如下:
    private void Form1_Load(object sender, System.EventArgs e)
    {
    pic1.Top=panel1.Top;
    pic1.Left=panel1.Left-panel1.Width;
    pic1.Height=panel1.Height;
    pic1.Width=2*panel1.Width;
    pic2.Top=panel1.Top;
    pic2.Left=panel1.Left-3*panel1.Width;
    pic2.Height=panel1.Height;
    pic2.Width=2*panel1.Width;
    } private void timer1_Tick(object sender, System.EventArgs e)
    {
    if(pic1.Left==panel1.Left+panel1.Width) pic1.Left=panel1.Left-3*panel1.Width;
    if(pic2.Left==panel1.Left+panel1.Width) pic2.Left=panel1.Left-3*panel1.Width;
    pic1.Left+=1;
    pic2.Left+=1;
    }
      

  5.   

    这种方法我早用过,我只是想知道如何用GDI+来实现,有没有人有源代码?