Copy Image in picturebox to another picturebox

G

Guest

I'm developing a drawing software in visual basic .Net and i need to copy the
image that exists in a picturebox and automaticaly paste it in another
picturebox as being part of that other image. Its something like this: in
pictureboxA we have the image of an head and in pictureboxB we have the image
of an eye, and i need to put the eye in pictureboxA, in its correct location
without the user even notice that there is a pictureboxB.
Now, i've tried several things and the closest i've got was something like
the code that i show here, but the problem is that when the image is
transfered to the other picturebox the image goes to a location that is not
the correct one. The varibles values are correct but for some reason the
image goes to an undifined location

picMolarSuperior.Top = lngPontoApiceMolarSuperior.Y
picMolarSuperior.Left = lngPontoContactoDistalPrimeiroMolar.X
picMolarSuperior.Height = (lngPontoContactoDistalPrimeiroMolar.Y -
lngPontoApiceMolarSuperior.Y) + 9
picMolarSuperior.Width = lngPontoContactoMesialPrimeiroMolar.X -
lngPontoContactoDistalPrimeiroMolar.X

Dim rectDados As New Rectangle(lngPontoApiceMolarSuperior.X,
lngPontoApiceMolarSuperior.Y, lngPontoContactoMesialPrimeiroMolar.X -
lngPontoContactoDistalPrimeiroMolar.X, (lngPontoContactoDistalPrimeiroMolar.Y
- lngPontoApiceMolarSuperior.Y) + 9)

Dim rectRetorno As Rectangle
rectRetorno = picMolarSuperior.ClientRectangle
picMolarSuperior.DrawToBitmap(picDraw.Image, rectRetorno)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top