VERSION 5.00
Begin VB.Form BitBltFromImageBox 
   Caption         =   "Form1"
   ClientHeight    =   2235
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5310
   LinkTopic       =   "Form1"
   ScaleHeight     =   149
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   354
   StartUpPosition =   3  'Windows Default
   Begin VB.PictureBox Picture1 
      BorderStyle     =   0  'None
      Height          =   1980
      Left            =   2760
      ScaleHeight     =   132
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   161
      TabIndex        =   0
      Top             =   120
      Width           =   2415
   End
   Begin VB.Image Image1 
      Height          =   1980
      Left            =   120
      Stretch         =   -1  'True
      Top             =   120
      Width           =   2415
   End
End
Attribute VB_Name = "BitBltFromImageBox"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

''
'' By Jamie Plenderleith
'' plenderj@tcd.ie
''

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 Function BitBltFromImageBox(ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal srcImgBox As Image, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
    BitBltFromImageBox = BitBlt(hDestDC, x, y, nWidth, nHeight, srcImgBox.Parent.hDC, xSrc + srcImgBox.Left, ySrc + srcImgBox.Top, dwRop)
End Function

Private Sub Form_Load()
    Show
    Image1.Picture = LoadPicture("c:\jamie\image.bmp")
    Picture1.AutoRedraw = True
    DoEvents
    BitBltFromImageBox Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, Image1, 0, 0, vbSrcCopy
    Picture1.Refresh
End Sub
