I have a question about something you said about a piece of code posted (by denniswrenn) a while back:
Code:Public Function TileImage(RefForm As Form, ImageToTile As PictureBox) As Boolean On Error GoTo error_TileImage Dim lngBitmapHandle As Long Dim lngFormHeight As Long Dim lngFormWidth As Long Dim lngPictureHeight As Long Dim lngPictureWidth As Long Dim lngPrevScale As Long Dim lngRet As Long Dim lngSourceDC As Long Dim lngX As Long Dim lngY As Long If Not RefForm Is Nothing And Not ImageToTile Is Nothing Then With ImageToTile lngPrevScale = .ScaleMode .ScaleMode = vbPixels lngPictureHeight = .ScaleHeight lngPictureWidth = .ScaleWidth .ScaleMode = lngPrevScale End With With RefForm lngPrevScale = .ScaleMode .ScaleMode = vbPixels lngFormHeight = .ScaleHeight lngFormWidth = .ScaleHeight .ScaleMode = lngPrevScale End With lngSourceDC = CreateCompatibleDC(RefForm.hdc) lngBitmapHandle = SelectObject(lngSourceDC, ImageToTile.Picture.Handle) For lngX = 0 To lngFormWidth Step lngPictureWidth For lngY = 0 To lngFormHeight Step lngPictureHeight lngRet = BitBlt(RefForm.hdc, lngX, lngY, lngPictureWidth, lngPictureHeight, lngSourceDC, 0, 0, SRCCOPY) Next lngY Next lngX lngRet = SelectObject(lngSourceDC, lngBitmapHandle) lngRet = DeleteDC(lngSourceDC) TileImage = True Else TileImage = False End If Exit Function error_TileImage: If Not RefForm Is Nothing Then RefForm.Tag = Err.Number & " " & Err.Description End If TileImage = False End FunctionI tried editing out the CreateCompatibleDC call, but I couldn't get it to function properly.... Also Dennis, you don't need to create your own DC's, and you only need to declare two variables.
I need this function to be as fast as possible so any clarification on what you said
would be much appreciated!
btw - The original thread was posted here: http://forums.vb-world.net/showthrea...threadid=17778
Thanks,
Jordan





Reply With Quote