日期:2014-05-17  浏览次数:21281 次

C#winform未响应问题
本帖最后由 dengjiejie1990 于 2012-12-13 13:24:59 编辑
窗体播放图片时。。如果我直接关闭窗体。。窗体就会发生未响应。。请问怎么解决这个问题??


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Test_Eight.Properties;

namespace Test_Eight
{
    public partial class AutoPlay : Form
    {
        public AutoPlay()
        {
            InitializeComponent();
        }

        private Bitmap MyBitmap; //事件公用变量

        //初始化
        private void AutoPlay_Load(object sender, EventArgs e)
        {
            Bitmap SrcBitmap = new Bitmap(Resources._1); //把打开的图像赋给Bitmap变量
            MyBitmap = new Bitmap(SrcBitmap, this.pictureBox_Show.Width, this.pictureBox_Show.Height);
            this.pictureBox_Show.Image = MyBitmap;       //在控件上显示图像
            timer_Change.Enabled = true;                 
        }

        //对接
        private void Joint()
        {
                try
                {
                    int width = this.pictureBox_Show.Width;//图像宽度
                    int height = this.pictureBox_Show.Height;//图像高度
                    Graphics g = this.pictureBox_Show.CreateGraphics();
                    g.Clear(Color.Gray);
                    Bitmap bitmap = new Bitmap(width, height);
                    int x = 0;
                    while (x <= height / 2)
                   &n