VB.net BitBlt绘制bitmap问题求高手
Dim h As IntPtrDim bmp As Bitmap
bmp = Pic.Image
Dim g1 As Graphics = Graphics.FromImage(bmp)
Dim g2 As Graphics = Me.CreateGraphics
Dim hdc1 As IntPtr = g1.GetHdc
Dim hdc2 As IntPtr = g2.GetHdc
h = SelectObject(hdc1, bmp.GetHbitmap)
BitBlt(hdc2, 50, 50, bmp.Width, bmp.Height, hdc1, 0, 0, 13369376)
SelectObject(hdc1, bmp.GetHbitmap)
DeleteObject(hdc1)
DeleteObject(bmp.GetHbitmap())
DeleteDC(hdc2)
绘制第1次 不能绘制第2次 第2次就无效了 而且每点运行一次就算没绘制到屏幕上 内存会增加直到内存不足 为什么用了DeleteObject内存依然无效扩大 用GDI+倒是简单 但是GDI的效率实在是太慢了 求一个 BitBlt绘制bitmap内存能正常的代码