Link to home
Start Free TrialLog in
Avatar of novologik
novologik

asked on

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 !!!!
Avatar of tasky
tasky

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

Avatar of novologik

ASKER

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 .....
 
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?
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?
ASKER CERTIFIED SOLUTION
Avatar of wonkotsane
wonkotsane
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you very much, every thing works, and it was very fast to change.... Thank you