if I have a form with, say, a picturebox in it. The picturebox is loaded with an image, and I need to copy just a section of it, say at rectangular points, X, Y, L and W to the clipboard, or to another picturebox. Is it possible in VB6?
Yes... but it will require a noxious amount of API calls with GDI. I suppose a great start would be researching GetDC() api call, and then working on learning BitBlt. You could probably get the device context of your picturebox, then use bitblt to get only a certain area of the picture and copy it to a new picturebox (you may want StretchBlt instead of bitblt) and from there, you can use the standard clipboard methods (clipboard.setdata()), or you can get crazy, and use the Clipboard API Calls.
You can also use PaintPicture () to get the portion of image
Dim iX As Integer, iY As Integer, iHeight As Integer, iWidth As Integer
Private Sub cmdCopy_Click()
'Set Destination Picture box width and Height
picDest.Width = iWidth
picDest.Height = iHeight
'Copy the Portion of picture from Source to Destination
picDest.PaintPicture picSource.Picture, _
0, 0, iWidth, iHeight, _
iX, iY, iWidth, iHeight
'Set drawn image to picture
picDest.Picture = picDest.Image
'Copy to Clipboard
Private Sub Form_Load()
iX = 1000 ' in twips
iY = 1000
iHeight = 2000
iWidth = 2000
picDest.AutoRedraw = True
I am working creating a fully encapsulated, homogeneous singly linked data structure. The Listing class and SinglyLinkedList class that are part of the whole application compile fine, but the problem ...