日期:2014-05-20  浏览次数:20691 次

用GDI+在窗体上的panel控件里画上一张2000像素宽的图片,拖动滚动条时图片画不全,好像是绘制的慢一样
用GDI+在窗体上的panel控件里画上一张2000像素宽的图片,拖动滚动条时图片画不全,好像是绘制的慢一样,不能很流畅的滚动图像,向哪个方向拖动哪个方向的图片和窗体边缘之间就有一小段画不上,拖动的很快时,图片和窗体边缘之间画不上图片的面积就大,拖动的慢画不上图片的面积就小, 好像和拖动滚动条的速度也有关系,试了NNNN次了,想了好多办法 还是照旧!实在没办法了!是GDI+的效率问题?不应该吧 画个图都会有这个问题?我想应该还是我的代码哪里有问题,代码如下,忘记说了,我这个窗体是一个子窗体
using   System;
using   System.Collections.Generic;
using   System.ComponentModel;
using   System.Data;
using   System.Drawing;
using   System.Text;
using   System.Windows.Forms;

namespace   MapEdit
{
        public   partial   class   newMap   :   Form
        {
                private   Image   im;//图片对像
                               
                private   Graphics   g;
                private   Graphics   g1;
                private   Bitmap   curBitmap;
               
                public   newMap(int   MapW,int   MapH,int   TitleW,int   TitleH)
                {
                        InitializeComponent();

                                             
                }
                               
                private   void   newMap_Load(object   sender,   EventArgs   e)
                {
                        im   =   Image.FromFile( "image.gif ");
                        panel1.Width   =   im.Width;
                        panel1.Height   =   im.Height;
                       
                        g   =   this.panel1.CreateGraphics();
                        g.Clear(Color.Black);
                        curBitmap   =   new   Bitmap(im.Width,   im.Height);
                        g1   =   Graphics.FromImage(curBitmap);
                        g1.DrawImage(im,   0,   0,   im.Width,   im.Height);
                }
               
                private   void   newMap_Paint(object   sender,   PaintEventArgs   e)
                {