I have a picturebox the contents of which I want to copy to another picturebox. If I do a direct BitBlt other controls sitting on top of the first picturebox are not copied so what I do is a screen capture and then BitBlt from the selected area (scales are all in pixels):
So I've found (by trial and error) that I must add twice the borderstyle property in order to take into account the form's left border. Now, as for the vertical coordinate of picSrc's top I'm not so sure what to do. Apparently from the result I should substract some pixels but I don't know how many and why.Code:picDest.Cls picDest.Width = picSrc.Width picDest.Height = picSrc.Height 'Capture screen Ret = GetDC(GetDesktopWindow) 'Select area of interest and copy it to picDest BitBlt picDest.hdc, 0, 0, picSrc.Width, picSrc.Height, Ret, _ Me.Left + picSrc.Left + 2 * Me.BorderStyle, _ Me.Top + Me.Height - Me.ScaleHeight + picSrc.Top, SRCCOPY
Both picSrc and picDst have Appearance = 0 (flat) and BorderStyle = 0 (none)




Reply With Quote