问题描述
C#中如何平滑滚动生成的大位图啊我是用的VC里的函数可以现实//以下为绘图部份[DllImport("gdi32.dll",ExactSpelling=true,SetLastError=true)]publicstaticexternIntPtrCreateCompatibleDC(IntPtrhDC);[DllImport("gdi32.dll",ExactSpelling=true,SetLastError=true)]publicstaticexternboolDeleteDC(IntPtrhdc);[DllImport("gdi32.dll",ExactSpelling=true)]publicstaticexternIntPtrSelectObject(IntPtrhDC,IntPtrhObject);[DllImport("gdi32.dll",ExactSpelling=true,SetLastError=true)]publicstaticexternboolDeleteObject(IntPtrhObject);[DllImport("gdi32.dll",ExactSpelling=true,SetLastError=true)]publicstaticexternIntPtrCreateCompatibleBitmap(IntPtrhObject,intwidth,intheight);[DllImport("gdi32.dll",ExactSpelling=true,SetLastError=true)]publicstaticexternboolBitBlt(IntPtrhObject,intnXDest,intnYDest,intnWidth,intnHeight,IntPtrhObjSource,intnXSrc,intnYSrc,intdwRop);[DllImport("gdi32.dll",ExactSpelling=true,SetLastError=true)]publicstaticexternintSetMapMode(IntPtrhdc,intfnMapMode);下面是初始化Graphicsclientdc=this.CreateGraphics();IntPtrhdc=clientdc.GetHdc();SetMapMode(hdc,7);//SetWindowExt(50000,1000);IntPtrhbitmap=CreateCompatibleBitmap(hdc,BaseX*3+Gdlength,MaxY);Membitmap=Bitmap.FromHbitmap(hbitmap);//Membitmap=newBitmap(BaseX*3+Gdlength,MaxY);//IntPtrhbitmap=Membitmap.GetHbitmap();hMemdc=CreateCompatibleDC(hdc);SelectObject(hMemdc,hbitmap);Memdc=Graphics.FromHdc(hMemdc);clientdc.Dispose();DeleteObject(hbitmap);可是当BaseX*3+Gdlength超过32767时候就不行了.Membitmap=Bitmap.FromHbitmap(hbitmap);Membitmap会为空,如何解决呢?好头痛啊还有,C#里怎么现实大图的平滑滚动啊,不要用VC里的函数.谢谢个位了.
解决方案
解决方案二:
自己贴自己顶,我用双缓冲可以让图片显示稍微好点.但还是闪,没有用VC那样做的平滑.不过BITMAP大小可以突破32767的限制了.怎么没人来回贴啊.20分太少了????有哪位朋友帮帮我啊!