resizing a form when a control resizes during execution 
Author Message
 resizing a form when a control resizes during execution

Hi!
I have a form with a windows media player control in it. The control
completely fills the form.When the play method is invoked in the player with
a filename, the player control's display is resized to fit the resolution of
the picture. But the form size remains the same so the control no longer
completely fills the form. I would like to make the form resize every time
the control's display widens, shortens etc., so as to make the control
completely fill the form. So if the control widens, the form also should
widen so that the entire picture can be seen. As of now, only a part of the
picture is seen since the form remains the same size even though the control
increased in width. Any solutions to this problem? Greatly appreciate any
help!

Thanks a lot
mythili



Tue, 29 Jan 2002 03:00:00 GMT  
 resizing a form when a control resizes during execution
Mythili ,
I don't use the Media control and don't really want to bother figuring it
out at the moment.
Are you talking about the MMControl? Well, it doesn't have an (obvious)
Resize event?
But what if you stuff it into an PictureBox.Autosize=True  and then do this?
Don't know if it will work, but worth a try Eh?
Please post back an answer whether it does the trick so I will know for the
future in case I need to do something sort of like this
 (may need to add or subtract something here or there ;-)?

Private Sub Picture1_Resize()
    With Picture1
        Form1.Move .Left, .Top, .Width, .Height
    End With
End Sub

Neila

Quote:

>Hi!
>I have a form with a windows media player control in it. The control
>completely fills the form.When the play method is invoked in the player
with
>a filename, the player control's display is resized to fit the resolution
of
>the picture. But the form size remains the same so the control no longer
>completely fills the form. I would like to make the form resize every time
>the control's display widens, shortens etc., so as to make the control
>completely fill the form. So if the control widens, the form also should
>widen so that the entire picture can be seen. As of now, only a part of the
>picture is seen since the form remains the same size even though the
control
>increased in width. Any solutions to this problem? Greatly appreciate any
>help!

>Thanks a lot
>mythili




Tue, 29 Jan 2002 03:00:00 GMT  
 resizing a form when a control resizes during execution
how about trying to put all of your resizing code, at least the part that
will affect the media player, in the form's Paint event. That way, whenever
it is redrawn with the new control sized how it is, it can resize at that
time. The Paint event happens a lot, so it's a good place to do things like
that. But be careful that you code isn't too intensive otherwise the Paint
event will execute lots of times, and take a while between times.


Quote:
> Mythili ,
> I don't use the Media control and don't really want to bother figuring it
> out at the moment.
> Are you talking about the MMControl? Well, it doesn't have an (obvious)
> Resize event?
> But what if you stuff it into an PictureBox.Autosize=True  and then do
this?
> Don't know if it will work, but worth a try Eh?
> Please post back an answer whether it does the trick so I will know for
the
> future in case I need to do something sort of like this
>  (may need to add or subtract something here or there ;-)?

> Private Sub Picture1_Resize()
>     With Picture1
>         Form1.Move .Left, .Top, .Width, .Height
>     End With
> End Sub

> Neila


> >Hi!
> >I have a form with a windows media player control in it. The control
> >completely fills the form.When the play method is invoked in the player
> with
> >a filename, the player control's display is resized to fit the resolution
> of
> >the picture. But the form size remains the same so the control no longer
> >completely fills the form. I would like to make the form resize every
time
> >the control's display widens, shortens etc., so as to make the control
> >completely fill the form. So if the control widens, the form also should
> >widen so that the entire picture can be seen. As of now, only a part of
the
> >picture is seen since the form remains the same size even though the
> control
> >increased in width. Any solutions to this problem? Greatly appreciate any
> >help!

> >Thanks a lot
> >mythili




Tue, 29 Jan 2002 03:00:00 GMT  
 resizing a form when a control resizes during execution
Hi!
I found a solution for it by putting a timer on the form and in the timer
event, I made the form dimensions follow the media player dimensions. So I
did something like this:

Private Sub Timer1_Timer()
If MediaPlayer1.Visible = True Then
  Let MediaPlayer2.Width = MediaPlayer1.Width
  Let MediaPlayer2.Height = MediaPlayer1.Height
  Let Form2.Width = MediaPlayer1.Width + 140
  Let Form2.Height = MediaPlayer1.Height + 710
  End If
 If MediaPlayer2.Visible = True Then
  Let MediaPlayer1.Width = MediaPlayer2.Width
  Let MediaPlayer1.Height = MediaPlayer2.Height
  Let Form2.Width = MediaPlayer2.Width + 140
  Let Form2.Height = MediaPlayer2.Height + 710
  End If
End Sub

I have two media player controls on one form, and hence the messy code as
above! The media player control resizes itself based on the clip it is
playing and this works pretty well. We need to set the timer interval small
enough in order that we can't see all this happening and large enough so
that we don't slow down the program.

But thanks a lot for your help! I think the paint event of the form should
work because it is basically the same thing. But I'm not sure how often the
event occurs. Since the timer event can be set to occur at intervals we
choose, it seemed more controllable.

I haven't tried the picture box thing so I don't know if it works.

Thanks a lot
mythili


Quote:
> how about trying to put all of your resizing code, at least the part that
> will affect the media player, in the form's Paint event. That way,
whenever
> it is redrawn with the new control sized how it is, it can resize at that
> time. The Paint event happens a lot, so it's a good place to do things
like
> that. But be careful that you code isn't too intensive otherwise the Paint
> event will execute lots of times, and take a while between times.



> > Mythili ,
> > I don't use the Media control and don't really want to bother figuring
it
> > out at the moment.
> > Are you talking about the MMControl? Well, it doesn't have an (obvious)
> > Resize event?
> > But what if you stuff it into an PictureBox.Autosize=True  and then do
> this?
> > Don't know if it will work, but worth a try Eh?
> > Please post back an answer whether it does the trick so I will know for
> the
> > future in case I need to do something sort of like this
> >  (may need to add or subtract something here or there ;-)?

> > Private Sub Picture1_Resize()
> >     With Picture1
> >         Form1.Move .Left, .Top, .Width, .Height
> >     End With
> > End Sub

> > Neila



Sat, 02 Feb 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. resizing a form when a control resizes during execution

2. Resize form - resize controls

3. Correction: Resize form - resize controls

4. Resizing a control when the Form is resized

5. Resizing all controls at form resize

6. Dynamically move/resize controls on resized form

7. Resize, resize, resize, ...

8. Resize Event fires during Form Load

9. Managing object positions during a form-resize event

10. Resizing Everything when Form Resizes

11. Resizing an object when a form is resized.....

12. Resizing components after form resize

 

 
Powered by phpBB® Forum Software