PictureBox pictureBox1 = new PictureBox();
          
            pictureBox1.Image = new Bitmap("C:\\BMP\\Tese.bmp");
            pictureBox1.Width = 256;
            pictureBox1.Height = 256;
        
            Bitmap NewBitmap = new Bitmap(pictureBox1.Width * 28, pictureBox1.Height * 40);  
            
            //For 循环跑到当机~有何方式能解决呢? 
            for(int i = 0 ; i <= 20 ;i++)
            {
                for (int x=0 ; x <= 30 ;x++)
                {
                pictureBox1.DrawToBitmap(NewBitmap, new Rectangle(i*256, x*256, 256, 256));
                }           
            }          NewBitmap.Save(Application.StartupPath + @"layout.tif", System.Drawing.Imaging.ImageFormat.Tiff );//保存路径
            NewBitmap.Dispose();
            MessageBox.Show("OK");

解决方案 »

  1.   

    For 循环跑到当机~有何方式能解决呢? 
    什么叫当机。
      

  2.   

      pictureBox1.DrawToBitmap(NewBitmap, new Rectangle(i*256, x*256, 256, 256)); 跑那么多次呀,
      

  3.   


    for(int i = 0 ; i <= 20 ;i++) 
                { 
                    for (int x=0 ; x <= 30 ;x++) 
                    { 
                    pictureBox1.DrawToBitmap(NewBitmap, new Rectangle(i*256, x*256, 256, 256)); 
    Thread.Sleep(100);
                    }          
                } 
      

  4.   

    小弟採用 Graphics.DrawImage 改善很多! 
      

  5.   

    写成子线程试试或者在循环内加一句
    Application.DoEvent();
    ----
    下面引蜘蛛的 不要管http://yule.cainiaopc.com
      

  6.   

    分几个线程跑
     for(int i = 0 ; i <= 5 ;i++) 
                { 
                    for (int x=0 ; x <= 30 ;x++) 
                    { 
                    pictureBox1.DrawToBitmap(NewBitmap, new Rectangle(i*256, x*256, 256, 256)); 
                    }          
                }  for(int i = 6 ; i <= 10 ;i++) 
                { 
                    for (int x=0 ; x <= 30 ;x++) 
                    { 
                    pictureBox1.DrawToBitmap(NewBitmap, new Rectangle(i*256, x*256, 256, 256)); 
                    }          
                } 
      

  7.   

    用BackgroundWorker 组件,不然主窗口就卡死在那里。//For 循环跑到当机~有何方式能解决呢?不知道你是哪里人,卡机怎么说成当机,第一次听这样说。^_^