Attribute VB_Name = "DirectDraw" ''Well, you could use DirectDraw. If your needs aren't that heavy, ''though... and you can assume Windows 98 and up (I think)... you ''can just use the TransparentBlt() API function. ''Here's some pertaining stuff out of my Imaging LibPack ''(available on my site)... Global Const MIN_LONG As Long = &H80000000 Declare Function TransparentBlt Lib "msimg32.dll" _ (ByVal DestHDC As Long, _ ByVal DestX As Long, _ ByVal DestY As Long, _ ByVal DestW As Long, _ ByVal DestH As Long, _ ByVal SrcHDC As Long, _ ByVal SrcX As Long, _ ByVal SrcY As Long, _ ByVal SrcW As Long, _ ByVal SrcH As Long, _ ByVal TransparentColor As Long) _ As Long Global Const MAGIC_PINK As Long = &HFF00FF Function DrawSprite _ (ByVal DestHDC As Long, _ ByVal SourceHDC As Long, _ ByVal X As Long, _ ByVal Y As Long, _ ByVal W As Long, _ ByVal H As Long, _ Optional ByVal ClipWidth As Long, _ Optional ByVal ClipHeight As Long, _ Optional ByVal Wrap As Boolean, _ Optional ByVal PinX As Long = MIN_LONG, _ Optional ByVal PinY As Long = MIN_LONG) ' Draws a "sprite" from an HDC If PinX <> MIN_LONG Then X = X - PinX Else X = X - (W \ 2) If PinY <> MIN_LONG Then Y = Y - PinY Else Y = Y - (H \ 2) If ClipWidth And Wrap Then If X < 0 Then TransparentBltClipped DestHDC, X + ClipWidth, Y, W, H, SourceHDC, 0, 0, MAGIC_PINK, ClipWidth, ClipHeight ElseIf X >= ClipWidth Then TransparentBltClipped DestHDC, X - ClipWidth, Y, W, H, SourceHDC, 0, 0, MAGIC_PINK, ClipWidth, ClipHeight End If End If If ClipHeight And Wrap Then If Y < 0 Then TransparentBltClipped DestHDC, X, Y + ClipHeight, W, H, SourceHDC, 0, 0, MAGIC_PINK, ClipWidth, ClipHeight ElseIf Y >= ClipHeight Then TransparentBltClipped DestHDC, X, Y - ClipHeight, W, H, SourceHDC, 0, 0, MAGIC_PINK, ClipWidth, ClipHeight End If End If TransparentBltClipped DestHDC, X, Y, W, H, SourceHDC, 0, 0, MAGIC_PINK, ClipWidth, ClipHeight End Function Function TransparentBltClipped _ (ByVal DestHDC As Long, _ ByVal DestX As Long, _ ByVal DestY As Long, _ ByVal W As Long, _ ByVal H As Long, _ ByVal SrcHDC As Long, _ ByVal SrcX As Long, _ ByVal SrcY As Long, _ ByVal TransparentColor As Long, _ Optional ByVal ClipWidth As Long, _ Optional ByVal ClipHeight As Long) _ As Long If ClipWidth Then If DestX + W > ClipWidth Then W = ClipWidth - DestX ElseIf DestX < 0 Then SrcX = SrcX - DestX W = W + DestX End If End If If ClipHeight Then If DestY + H > ClipHeight Then H = ClipHeight - DestY ElseIf DestY < 0 Then SrcY = SrcY - DestY H = H + DestY End If End If TransparentBltClipped = TransparentBlt(DestHDC, DestX, DestY, W, H, SrcHDC, SrcX, SrcY, W, H, TransparentColor) End Function ''Basically DrawSprite() is just a wrapper for TransparentBlt with the ''following properties: ''o The transparent color is assumed to be "magic pink". This is fairly ''common.RGB 255, 0, 255# ''o It has a "wrap" mode... if the sprite extends to the left/up of 0, it ''draws that part on the right/bottom... if it extends to the right/below, ''it draws it on the left/top. You know what I mean. In a lot of old ''games when you go off the screen, you come out the other side. ''o You can specify "pin" coordinates. DrawSprite will center drawing on ''the "pin" instead of on (0,0) like normal. You can tell it the pin is ''(0,0) if you want, or set some other arbitrary value. The default is ''for the pin to be in the middle of the sprite. ''It could use a couple more little features... I'm not sure why I don't ''have the transparent color as an optional default parameter, for instance. ''And it might as well be able to clip/wrap to an arbitrary position on the ''left/top sides instead of being fixed at 0. But whatever. There it is if ''you want it.