How can I create a shape (oval) over a picture box and see both of them ?

I create two picture box one over the other. I want to add a shape (Oval) over them but I want to see every thing at the same time.

Depending of the user choice, each picture box or shape can be visible or invisible. When I try to put the shape over the picture box ... it always go behind ...... I would like to be able to draw someting over a picture box .....

Please help me....

Thanks in advance !!!!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can use the Picture1.Circle method to draw an oval.

.Circle [Step] (x, y), radius, [color, start, end, aspect]

Picture1.Circle (3000, 3000), 1000, vbBlue, , , 0.5

Open in new window

The reason your shape control is disappearing behind the picturebox is because the picturebox control is a container with an opaque background.  When you draw your shape on the form, draw it onto the picturebox rather than the form and then resize it.

If you want to actually draw the elipse on the picturebox at runtime rather than using a control then you can do that too using the examples below.  The first two parameters (in brackets) are the x and y co-ordinates of the elipse.  The next parameter is the radius followed by the colour of the line.  You don't need the next two to draw an elipse and the final parameter is the aspect ratio.  An aspect ratio of 1 is a circle.  An aspect ratio less than 1 will make the elipse wider than it is tall and an aspect ratio greater than 1 will make it taller than it is wide.
'Perfect Circle
Picture1.Circle (x, y), 20, vbRed, , , 1
'Elipse twice as wide as high
Picture1.Circle (x, y), 20, vbRed, , , .5
'Elipse twice as high as wide
Picture1.Circle (x, y), 20, vbRed, , , 1.5

Open in new window

novologikAuthor Commented:
Thank for your comment, but it's not what I need. The Oval should be over the picturebox not inside, it should be bigger than the picturebox..... It's why I try with a shape component .....
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Do you mean the elipse should be kind of around the picturebox control but the corners of the picturebox are outside of the elipse?

Is there any reason you can't use an imagebox control instead of picturebox?
novologikAuthor Commented:
Yes it's what I mean.

Wiith a imagebox it works....

The only reason why I don't want to use an imagebox, it's because I will have to change around 90 control in two different form, reposition them, etc.... Do you know an easy way to change them?
There is another way of doing this but I'm trying to figure out the maths involved!  Basically, draw your shape around the picturebox and then draw an elipse with the same dimensions in the picturebox.

Alternatively, if changing to image controls won't cause any other problems you can change them in bulk by editing your .frm file in notepad.

A picturebox control in your form will look like this:

   Begin VB.PictureBox Picture1
      Height          =   2295
      Left            =   360
      ScaleHeight     =   2235
      ScaleWidth      =   3435
      TabIndex        =   0
      Top             =   360
      Width           =   3495

An image control on your form will look like this:

   Begin VB.Image Image1
      Height          =   2415
      Left            =   4080
      Top             =   480
      Width           =   3135

You might have some extra properties in there depending on what properties you've set at design time.  BACK UP your .frm file and then do a find and replace VB.PictureBox with VB.Image.  Save your .frm file and open your project.  When displaying your modified form for the first time you will get a message saying there are errors - this is because of the extra properties that the picturebox control has that don't exist in the image control.  Just click ok and save the form.  The unsupported properties will disappear and all your pictureboxes will have been replaced with image controls.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
novologikAuthor Commented:
Thank you very much, every thing works, and it was very fast to change.... Thank you
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.