Someone Help me in Zooming my Form!!
I need small code... Just to enable me, to can Zoom In and Out my Form1.form including ImageBox and Circle or Line.
[IMG]http://img246.imageshack.us/img246/5653/10ez.jpg[/IMG]
And this when you click minimize for Zooming Out;
[IMG]http://img246.imageshack.us/img246/8997/24go.jpg[/IMG]
Thank You very Much
Re: Someone Help me in Zooming my Form!!
if i understand what you are trying to do correctly then this should work:
when you press the minimise button the code for the imagebox should be something like this (makes it halfsize)
VB Code:
ImageBox.Height = ImageBox.Height/2
ImageBox.Width = ImageBox.Width/2
and then to maximise it again
VB Code:
ImageBox.Height = ImageBox.Height*2
ImageBox.Width = ImageBox.Width*2
ive never used a circle so im not sure how they work but they would either have a radius, or a X1-X2, Y1-Y2.
If they have a radius control, ie circle.radius then you need to do the same as above:
VB Code:
Circle.Radius = Circle.Radius/2
if it uses the X1-X2, Y1-Y2 method, i would think you need something like this:
VB Code:
Circle.X2 = (Circle.X1 + Circle.X2) / 2
Circle.Y2 = (Circle.Y1 + Circle.Y2) / 2
this will keep the top left corner in the same place and shrink the rest to halfsize
my explanations tend to be longwinded but hopefully you get the idea.
matt
Re: Someone Help me in Zooming my Form!!
Hi Captain-alan,
I don't believe you can "zoom the form". You would have to resize and reposition all the controls. There's plenty of messages in this forum about re-sizing controls.
The basics would be like asilaydying said. But instead of using a fixed number I would use a variable. And then just set the number less than one to shrink and greater than one to enlarge.
I.E. width=width*ratio. { ratio=.5 (shrink) ratio=2 (enlarge) }
Re: Someone Help me in Zooming my Form!!
Keith is right, there is no zoom command. The only way to zoom is actually to trick the user into thinking they are zooming by manually changing the size and repositioning all of the objects. asilaydying covered the changing size, but remember to move them aswell. For instance, while you do this (zooming out)...
VB Code:
ImageBox.Height = ImageBox.Height/2
ImageBox.Width = ImageBox.Width/2
Also do this...
VB Code:
ImageBox.Left = ImageBox.Left + ImageBox.Width/2
ImageBox.Top = ImageBox.Top + ImageBox.Height/2
EDIT: for my method above, remember to reposition after you resize. If you want to do it the other way add a quarter of the height and width.