Hi Dave<br>
<br>
I know what you want to do. You could use the Paintpicture method but for speed and functionality you need to become familiar with BitBlt. Below is a very quick and dirty intro.<br>
<br>
BitBlt has the following declaration:<br>
<br>
Public 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<br>
<br>
where<br>
<br>
hDestDC is the handle to the device context you want to BitBlt to - or, in English, a reference number to the object you want to draw on. It also means that you can only BitBlt to certain controls, i.e. ones which have an hDC, e.g. a Form, a PictureBox, a Frame, etc. You cannot BitBlt to an Image control.<br>
<br>
x and y are the X and Y co-ordinates of the destination - i.e. the top left corner of the picture you "paste" will be here. These are usually both 0 if you want to place the picture in the top left corner of the target but you needn't - you can choose to paste it anywhere in the image.<br>
<br>
nWidth and nHeight specify the size of the image to be pasted. This can be bigger or smaller than either the source or the target - so you can "copy" a piece from a picture and "paste" it anywhere in the target.<br>
<br>
hSrcDC is the hDC to the picture you want to BitBlt from. Same restraints and conditions as with the destination hDC (hDestDC).<br>
<br>
xSrc and ySrc are the co-ordinates from which you would like to start BitBlt-ing on the source picture. Again, these are usually 0, but in your case you will set them to the top-left corner of the picture you want to copy from within the larger image. Note that there are no Width or Height parameters which means that the part of the picture you copy cannot be resized (with this function - there are others which can do it).<br>
<br>
dwRop is a flag representing the Raster Operation - i.e. how it "pastes" the source into the destination. I've listed the ROps below. For the moment play with SRCCOPY.<br>
<br>
Private Const BLACKNESS = &H42<br>
Private Const DSTINVERT = &H550009<br>
Private Const MERGECOPY = &HC000CA<br>
Private Const MERGEPAINT = &HBB0226<br>
Private Const NOTSRCCOPY = &H330008<br>
Private Const NOTSRCERASE = &H1100A6<br>
Private Const PATCOPY = &HF00021<br>
Private Const PATINVERT = &H5A0049<br>
Private Const PATPAINT = &HFB0A09<br>
Private Const SRCAND = &H8800C6<br>
Private Const SRCCOPY = &HCC0020<br>
Private Const SRCERASE = &H440328<br>
Private Const SRCINVERT = &H660046<br>
Private Const SRCPAINT = &HEE0086<br>
Private Const WHITENESS = &HFF0062<br>
<br>
Now you have the tools. To play with with them you will need (at least) two PictureBox controls. Make sure that their AutoRefresh properties are set to True. I would also suggest setting the ScaleMode to Pixel (3) and the AutoResize to False after yoo have loaded pictures into the picture boxes (at design time).<br>
<br>
Try the following:<br>
<br>
BitBlt Pic1.hDC, 0, 0, 20, 20, Pic2.hDC, 5, 5, SRCCOPY<br>
Pic1.Refresh<br>
<br>
Note the Refresh - It's quite important.<br>
This should copy a 20x20 pixel area from Pic2 (starting 5 pixels in and 5 pixels down) to the top left corner of Pic1.<br>
<br>
Good Luck. If you need more samples I'll be glad to help.<br>
Ian