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

为何图像绘制不出来
代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;

namespace texun
{
    public partial class Form1 : Form
    {

        private bool isStart = false;
        Thread pt = null;
        public int i = 0;
        private Graphics newDM = null;
        private Bitmap bufferimg = null;
        
        
        
        public Form1()
        {
            InitializeComponent();
            LaunchForm();
           
        }

        private void LaunchForm()
        {
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint, true);
            isStart = true;

            newDM = Graphics.FromImage(bufferimg);
        }

        private void PaintThread()
        {
            while (isStart)
            {
                DMMove(newDM);
                this.Invalidate();
                Thread.Sleep(100);
            }