I’ve got a problem with Bitblt. When I use it to draw things the first time gdi objects are created and I can’t find out how to destroy them. I’m simply tiling a bitmap(using bitblt) onto a picturebox and then am putting the result into a picturebox which I want to store the image in. Since the processing must be invisible the pictures’ autoredraw properties are set to true. Here is the code that I am using:
When I look at the amount of gdi objects in task manager I see that 3 are created during this process, would like to chop it down to 0.Code:Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long Private Sub Command1_Click() picRender.Width = 400: picRender.Height = picTile.Height For i = 0 To 400 Step picTile.Width BitBlt picRender.hDC, i, 0, picTile.Width, picTile.Height, picTile.hDC, 0, 0, vbSrcCopy Next i picRender.Picture = picRender.Image picDest.Picture = picRender.Picture picRender.Picture = Nothing End Sub
Help will be much appreciated


Reply With Quote
