VB.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 306,776 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,609 people online right now. Registration is fast and FREE... Join Now!




Resize Form

 

Resize Form, resizing to screen dim

AlexG788

7 Apr, 2009 - 12:58 PM
Post #1

D.I.C Head
**

Joined: 28 Jan, 2009
Posts: 61



Thanked: 1 times
My Contributions
Hi,
I'm trying to figure out how to resize a form on load to fit to the user's screen. Many of my users are on laptops, or split screens between laptop and monitor..

I remember in VB6, it was something like form.height = screen.height (or something of the sort)... but I can't find this functionality in VB.NET 2008

Let me know. I'm also trying to wrap everything (multiple screens/forms) into one app, so I wanted to know if anyone was aware of any tutorials on form parent/child relationships... I don't want to keep opening and hiding forms individually without having them packaged in one work area....

Thanks as always!

User is offlineProfile CardPM
+Quote Post


prabh

RE: Resize Form

7 Apr, 2009 - 01:27 PM
Post #2

D.I.C Regular
Group Icon

Joined: 27 Dec, 2008
Posts: 292



Thanked: 8 times
Dream Kudos: 25
My Contributions
QUOTE(AlexG788 @ 7 Apr, 2009 - 12:58 PM) *

Hi,
I'm trying to figure out how to resize a form on load to fit to the user's screen. Many of my users are on laptops, or split screens between laptop and monitor..

I remember in VB6, it was something like form.height = screen.height (or something of the sort)... but I can't find this functionality in VB.NET 2008

Let me know. I'm also trying to wrap everything (multiple screens/forms) into one app, so I wanted to know if anyone was aware of any tutorials on form parent/child relationships... I don't want to keep opening and hiding forms individually without having them packaged in one work area....

Thanks as always!

hi
if you change form property
of window state to maximized it will take the size of the end-users screen
User is offlineProfile CardPM
+Quote Post

Jayman

RE: Resize Form

7 Apr, 2009 - 02:37 PM
Post #3

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 8,570



Thanked: 237 times
Dream Kudos: 500
Expert In: Everything

My Contributions
I think you are looking for:

CODE

Me.Height = Screen.Height

User is offlineProfile CardPM
+Quote Post

AlexG788

RE: Resize Form

8 Apr, 2009 - 05:24 AM
Post #4

D.I.C Head
**

Joined: 28 Jan, 2009
Posts: 61



Thanked: 1 times
My Contributions
QUOTE(Jayman @ 7 Apr, 2009 - 02:37 PM) *

I think you are looking for:

CODE

Me.Height = Screen.Height




screen.height for some reason is not a function of VB.NET 2008.... unless I'm not referencing something I should be... when i insert this statement into my code, VS underlines it and says:

Height is not a member of system.windows.forms.screen]

Also if I select Maximized in the Window State (properties) box, nothing happens, its still the original size
User is offlineProfile CardPM
+Quote Post

zhaynes

RE: Resize Form

8 Apr, 2009 - 12:36 PM
Post #5

New D.I.C Head
*

Joined: 8 Apr, 2009
Posts: 2


My Contributions


this should work in vb 2008

CODE

Me.WindowState = FormWindowState.Maximized


This post has been edited by zhaynes: 8 Apr, 2009 - 12:37 PM
User is offlineProfile CardPM
+Quote Post

microstoc

RE: Resize Form

8 Apr, 2009 - 01:33 PM
Post #6

D.I.C Head
**

Joined: 4 Apr, 2009
Posts: 59



Thanked: 5 times
My Contributions
QUOTE(zhaynes @ 8 Apr, 2009 - 12:36 PM) *

this should work in vb 2008

CODE

Me.WindowState = FormWindowState.Maximized



I don't know if this helps, but it seems relevant.

'actual screen dimensions
Dim ScreenWidth as Integer = Screen.PrimaryScreen.Bounds.Width
Dim ScreenHeight as Integer = Screen.PrimaryScreen.Bounds.Height

'actual working area (i.e. actual screen dimensions less the taskbar dimensions etc)
Dim FormTop as Integer = Screen.PrimaryScreen.WorkingArea.Top
Dim FormLeft as Integer = Screen.PrimaryScreen.WorkingArea.Left
Dim FormRight as Integer = Screen.PrimaryScreen.WorkingArea.Right
Dim FormBottom as Integer = Screen.PrimaryScreen.WorkingArea.Bottom
Dim FormHeight as Integer = Screen.PrimaryScreen.WorkingArea.Height 'FormBottom-FormTop



User is offlineProfile CardPM
+Quote Post

yangma

RE: Resize Form

22 Jun, 2009 - 09:40 PM
Post #7

D.I.C Head
**

Joined: 3 May, 2009
Posts: 50

okai...if it is maximized then it fits into the screen..but the control and buttons and textboxes will be there in its original place..how can i move the buttons along with the size of the form...
thanks
User is offlineProfile CardPM
+Quote Post

zippp

RE: Resize Form

22 Jun, 2009 - 11:41 PM
Post #8

New D.I.C Head
*

Joined: 22 Jun, 2009
Posts: 39



Thanked: 4 times
My Contributions
QUOTE(yangma @ 22 Jun, 2009 - 09:40 PM) *

okai...if it is maximized then it fits into the screen..but the control and buttons and textboxes will be there in its original place..how can i move the buttons along with the size of the form...
thanks


can you post a printscreen with your project?

User is offlineProfile CardPM
+Quote Post

TEH

RE: Resize Form

23 Jun, 2009 - 01:07 AM
Post #9

D.I.C Head
Group Icon

Joined: 30 Jan, 2008
Posts: 72



Thanked: 5 times
Dream Kudos: 25
My Contributions
QUOTE(yangma @ 23 Jun, 2009 - 07:40 AM) *

okai...if it is maximized then it fits into the screen..but the control and buttons and textboxes will be there in its original place..how can i move the buttons along with the size of the form...
thanks


Take a look at every control properties -box, there should be an anchor- selection.
Thius is what tells to your program in witch borders are components anchored, so which border is that which moves the component along.


User is offlineProfile CardPM
+Quote Post

yangma

RE: Resize Form

25 Jun, 2009 - 09:31 PM
Post #10

D.I.C Head
**

Joined: 3 May, 2009
Posts: 50

thanks ..anchor property was not set accordingly...
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/20/09 07:02PM

Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month