Resizing

I had the following in the Resized event which seemed to work to an extent

PlayerWnd.Height = PlayerWnd.Width *.6

but when I changed it to the following it now crashes when I drag the window to its max width

PlayerWnd.Height = PlayerWnd.Width *.6
if playerwnd.Height > screen(0).AvailableHeight then
PlayerWnd.Height = screen(0).AvailableHeight
end if

I can’t see why though??

RECURSION
you change PlayerWindHeight
then check if it is greater than Screen Height
if it is you change it again (which call resize, which in turn changes it to Width*.6 again

Its a never ending cycle

No need to post your question twice… if in wrong area , just move it

And if the title is wrong, you can change it too (Resizing or Resized ? They are two different Events).

Cheers :wink:

Thanks Dave, also didnt realize tge double post. I’m on a less tge 3g connection where pages often take 5 minutes or time out so bit of a struggle.

I tried a couple things since but still getting caught causing the recursion. I cant see how to always keep the height 60% of the width except when the height exceeds the avalable height then it is equal to the screen height. Programatically it sounds easy but i seem to keep firing the resized event??

The sample that @Jay Madren provided did not get you started in the right direction?

I thought this would solve the issue but the window still draws larger than the available screen.
If you create a new project with a window and label and put the following in the Rezsized event, it shows that it gets a minimum val correctly but still draws the window bigger than the screen and if you put the dock at the bottom it draws into the dock space. When the dock isn’t there it draws past the screen. I can fudge it and just *.95

dim calheight as integer = window1.width *.6
dim minheight as integer = min(screen(0).Availableheight,window1.width *.6)
window1.height = min(screen(0).Availableheight,window1.width *.6)

Label1.Text = " MH=“+minHeight.ToText +”: " +" CalH=" + calheight.ToText