|
-
Jun 12th, 2002, 02:45 PM
#1
Thread Starter
Frenzied Member
Mixing Two Pictures Together...
I know it sounds kind of funny or even silly, but what if we need to mix two Pictures into a PictureBox or Image Control in order to be able to draw a Mask?
For example, lets think we are going to draw a Rectangle using 9 different Pictures, 4 will be the Corners, 4 will be the Lines connecting the Corners and 1 would be the Center. Now, we have a PictureBox where we want to draw the first Corner at (0,0) then the first Line at (Corner1.left + Corner1.width, 0) then the second Corner at (Line1.left + Line1.width, 0); The second Line at (0, Corner1.top + Corner1.height)... And you get the idea.
Is there anyway to be able to do this?
Thanks for your attention
We miss you, friend...  Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
-
Jun 12th, 2002, 08:56 PM
#2
Thread Starter
Frenzied Member
There is indeed a way to Combine Pictures inside a PictureBox, I passed the night thinking of it and I found an easy solution to my very own post.
Why to publish the solution to this question I posted? I want others that may have the same doubts as me to know how to solve this issue. I am used not to be answered in the forums, so I try myself as I wait. I usually get to find myself an answer before they can give one... Anyway, too much talk here comes how to do it.
Lets think we have a PictureBox named "Mask", this will be where we will combine our two Pictures. The first Picture will be "Picture1" and the second Picture will be "Picture2". So we are going to use the PaintPicture Method of the PictureBox for this purpose. Finally we are going to Save this Image we Painted into the Picture property of "Mask". In order to make this work we will need to Have "Mask"'s AutoRedraw property set to True.
Remember the Method PaintPicture's sintax is:
object.PaintPicture picture, x1, y1, width1, height1, x2, y2, width2, height2, opcode
Where x1, y1 will be the point we will begin to draw the Picture on. Take in consideration x1 and y1 are needed to be written, they are not optional while the other arguments can be optional. width1 and height1 will be the Width and Height we want our Picture to take (This is really useful if you are going to stretch a Picture). x2, y2 will be the clipping coordinates of a region inside of the Picture and width2 and height2 are the source's Width and Height of our Picture.
Here is a sample of the code:
Mask.AutoRedraw = True
Mask.Picture = LoadPicture("")
Mask.PaintPicture Picture1.Picture, 0, 0
Mask.PaintPicture Picture1.Width, Picture1.Height, Picture2.width + 40, Picture2.Height + 40
Mask.Picture = Mask.Image
Finally all what is needed is to see how to make the UserControl recognize the MaskPicture you have. I will have to investigate about this, because it still shows all the control's background and not only the given by the MaskPicture property. If you have any idea of how to do this, please post it.
We miss you, friend...  Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
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
|