制作控件时要给e.Graphic绘制图像。我的做法是e.Graphic.DrawImage(image,0,0)
但我觉得这样速度太慢了。有什么好的加速方法吗。
能使用在C#能调用的别的语言写的方法也行。谢谢!

解决方案 »

  1.   

    windows api不一定快,openGL native interop方式在.net下大概慢了5倍,marshal的原因吧。
    Graphics class 下的一些属性
    CompositingMode
    CompositingQuality
    如果多个图形有重叠,试试部分渲染。
      

  2.   

    呵呵。directx到不错,而且,现在机器一般都安装了的,可以试试!
      

  3.   

    GDI要比GDI+要快不少
    DirectDraw比GDI又要快一点
    不过DiretDraw和GDI要求你用C/C++编程一般启用双缓冲后就没有这种问题了,用不着想得那么麻烦
      

  4.   

    我用BitBlt进行图像复制,
    BitBlt ( dc4 , 0 , 0 , this.Width , this.Height , dc2 , 0 , 0 , 13369376) ;
    为什么窗体只显示黑色,而不是显示出图像来呢?
    但,反过来
    BitBlt ( dc2 , 0 , 0 , this.Width , this.Height , dc4 , 0 , 0 , 13369376) ;
    则能把窗体复制到图像中。为什么会这样???Bitmap MyImage = (Bitmap)Bitmap.FromFile("D:\\Mybmp.bmp");
    Graphics g2 = Graphics.FromImage ( MyImage ) ;
    //获得屏幕的句柄
    IntPtr dc4 = GetDC(this.Handle);//窗体的Handle
    //获得位图的句柄
    IntPtr dc2 = g2.GetHdc ( ) ;
    //拷贝位图
    BitBlt ( dc4 , 0 , 0 , this.Width , this.Height , dc2 , 0 , 0 , 13369376) ;
    g2.ReleaseHdc ( dc2 ) ;
    ReleaseDC(this.Handle,dc4);
      

  5.   

    为了更好的交流,请到http://www.dj9394.com/it/注册一个,上面通知好几个.net 学习群共同交流了