So basically, I have an image that needs to be overlayed onto a second image on a form.
Here's the catch: the second image needs to be user defined( everyone I ask says merge them in photoshop)
How would I do this?(I've only been coding about a month)
Any help is appreciated
Overlaying images help
Page 1 of 16 Replies - 399 Views - Last Post: 01 May 2012 - 03:28 PM
Replies To: Overlaying images help
#2
Re: Overlaying images help
Posted 27 April 2012 - 06:54 AM
You can do this with GDI+ and draw images on top of each other. In a paint event for the control your drawing the image to - use the e.Graphics.DrawImage method. If the second image does not have any transparency you will not see the first image.
#3
Re: Overlaying images help
Posted 27 April 2012 - 12:03 PM
_HAWK_, on 27 April 2012 - 06:54 AM, said:
You can do this with GDI+ and draw images on top of each other. In a paint event for the control your drawing the image to - use the e.Graphics.DrawImage method. If the second image does not have any transparency you will not see the first image.
So the underlying image needs transparency as well?
#4
Re: Overlaying images help
Posted 27 April 2012 - 12:29 PM
Confuzed, on 27 April 2012 - 12:03 PM, said:
_HAWK_, on 27 April 2012 - 06:54 AM, said:
You can do this with GDI+ and draw images on top of each other. In a paint event for the control your drawing the image to - use the e.Graphics.DrawImage method. If the second image does not have any transparency you will not see the first image.
So the underlying image needs transparency as well?
No, only the image you will draw on top of the underlying one needs transparency. What I think he means is, if the image specified by the user has no transparency, you will not see the underlying image.
#5
Re: Overlaying images help
Posted 27 April 2012 - 12:59 PM
Can you guys give me a sample on how to use this method?
#6
Re: Overlaying images help
Posted 27 April 2012 - 02:20 PM
You need some idea of your needs before you build the graphics part. Are you needing only 2 images or more than 2? If it is the first, you can set the first image as the BackgroundImage for a picturebox and then in the picturebox's paint event you simply draw that other image that the user selects onto the picturebox, like:
Private myImages As New List(Of Image)'collection/array
Private Sub pb_Paint(sender As Object, e As PaintEventArgs) Handles pb.Paint
'if you only have a second image draw it to the
'picturebox's rectangle dimensions
e.Graphics.DrawImage(<image>, pb.ClientRectangle)
'or loop thru a collection
For Each img As Image In myImages
e.Graphics.DrawImage(img, pb.ClientRectangle)
Next
End Sub
#7
Re: Overlaying images help
Posted 01 May 2012 - 03:28 PM
You can use code similar to watermarking images. You can draw a bitmap on top of the other and if you have set the tranparency to an amount lower than 255, you will see the image underneath.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|