form useable area

P

Paul Mars

How can I get the useable dimensions or coordinates of the working area of a
form?

All that I can find return the monitor screen area, but I need the usable
area inside the open form. Not incl. menu, toolbar, status bar.


Dim x As Integer = MdiParent.Height

Me.SetDesktopBounds(0, 0, 0, 0)

'Me.SetDesktopLocation(0, 0)

'Me.Top = CInt(MdiParent.ClientSize.Height)

'Me.Top = CInt(Screen.PrimaryScreen.Bounds.Height)
 
P

Paul Mars

yes and that does not work.

Me.Top = CInt(MdiParent.ClientSize.Height)
puts the Me form down below the visible bottom of screen, so then user needs
to scroll to see it. And
Me.Top = CInt((MdiParent.ClientSize.Height - Size.Height) / 2)

puts the Me form below the middle of useable form screen area.

Both these will work for setting the first form on my screen, but setting a
child form inside a parent is not working.



P
 
K

Ken Tucker [MVP]

Hi,

Dim frm As New Form1

frm.MdiParent = Me
frm.Width = Me.ClientSize.Width - 5
frm.Height = Me.ClientSize.Height - 25


Ken
 
A

AlexS

Did you look at Form.ClientSize ?

The rest is basics - usable area starts at (0,0) and up to Width-1 and
Height-1.

HTH
Alex
 
A

Armin Zingler

Paul Mars said:
yes and that does not work.

Me.Top = CInt(MdiParent.ClientSize.Height)
puts the Me form down below the visible bottom of screen, so then
user needs to scroll to see it. And
Me.Top = CInt((MdiParent.ClientSize.Height - Size.Height) / 2)

puts the Me form below the middle of useable form screen area.

Both these will work for setting the first form on my screen, but
setting a child form inside a parent is not working.


What's your intention? Where do you want to move the child to?


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
P

Paul Mars

in my project
MDIParent.ClientSize.Height - 100 or
Screen.PrimaryScreen.Bounds.Height - 180

either one works. I just thought that there would(should) be a way to return
the useable open space. I guess not. This still works if I change
resolution. I hope that it works on different computers.

Paul
 
P

Paul Mars

1 - minimize a child form to lower left. There is a minimize method, but it
is not working.

2 - A child is displayed in center of Parent, then it is made larger. When
it is made larger, I want it still center of Parent. Then it is made smaller
again and it needs to be re-centered.

paul
 
A

Armin Zingler

Paul Mars said:
1 - minimize a child form to lower left. There is a minimize method,
but it is not working.

I didn't find a Minimize method. Though, when I manually minimize the child,
it's located at the bottom left of the parent, as expected. This also works
when setting the minimized WindowState in code.
2 - A child is displayed in center of Parent, then it is made larger.
When it is made larger, I want it still center of Parent. Then it is
made smaller again and it needs to be re-centered.

This is done by

Me.Top = CInt((MdiParent.ClientSize.Height - Size.Height) / 2)

It works here. The only thing you have to subtract is a 4 pixel border not
covered by MDI child windows, so it's:

Me.Top = (MdiParent.ClientSize.Height - 4 - Size.Height) \ 2

Now it's centered (vertically). I'm not sure if it's always 4 pixels.


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top