To detect keypresses in a picturebox, use the picturebox's KeyPress event. However, I bet this doesn't work for you because the picturebox usually isn't in focus. In this case, set the form's KeyPreview to true, which will allow the form itself to retrieve keypresses before any other object. So, just have the form carry out keypresses for your picturebox.
What's wrong with using BitBlt? It's much faster and cleaner, I bet you're just afraid of how to use it.
Paste this into your general declarations of your form:
This simply copies the source bitmap to the destination. Make sure the scalemodes of your two pictureboxes are in pixels.Code:Private Declare Function BitBlt Lib "gdi32" Alias "BitBlt" (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 Const SRCCOPY = &HCC0020 ' (DWORD) dest = source '----------- 'Usage BitBlt Picture1.Hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, Picture2.hdc, 0, 0, SRCCOPY




Reply With Quote