|
-
August 5th, 2011, 04:47 AM
#1
Overlay images: PictureBox or DrawImage?
I'm writing an application to create photomontages, or better a kind of Face In Hole: I have a mask (for istance: Monnalisa painting) with a transparent hole on the face, I wanna load one of my photo and put it under the mask.
To achieve this, I created 2 PictureBox in the same position and I setted: mask.BackColor = Color.Transparent, but this solution doesn't work.
So, I tried to avoid PictureBox and I used just DrawImage in the same position on the form.. it works!!
The problem is that in this way I can't use MouseMove to position my face in the center of the mask.. What can I do?
I was thinking to create a PictureBox with my photo and use DrawImage to draw the mask over the PictureBox . I'm not so sure that I can do that.
Have you a better solution?
Any suggestion is welcome!
-
August 5th, 2011, 01:44 PM
#2
Re: Overlay images: PictureBox or DrawImage?
It doesn't work because WinForms controls do not support true transparency, and even when configured to support pseudo transparency you will run into issues.
You can of course draw the image in memory and then show it as you have done. You are wrong in saying that you can no longer use mouse move to position the subimage, you just have to do so in a different way. Handle mouse move, keep track of the mouse position, call Invalidate() which will in turn call OnPaint which is where you should be rendering the image again (depending on the mouse position).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|