Solved

Controls resize depending on the monitor size

Posted on 2016-10-05
7
24 Views
Last Modified: 2016-10-11
Hello,

Iam using vb.net 2015.  Is there any way that I can resize the controls on the form and the resize the  form  depending on the monitor size.

Cheers
0
Comment
Question by:RIAS
  • 3
  • 3
7 Comments
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 41830315
I normally set an anchor to the controls so they'll grow automatically.

You can use the screen class to determine the resolution of the screen:
https://msdn.microsoft.com/en-us/library/system.windows.forms.screen.aspx
 Dim screenWidth as Integer = Screen.PrimaryScreen.Bounds.Width
 Dim screenHeight as Integer = Screen.PrimaryScreen.Bounds.Height

Open in new window


You can then set the form's height and width to whatever you like.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 41830400
I also use the Anchor property which I sometimes combine with Layout containers: http://emoreau.com/Entries/Articles/2010/01/The-Table-and-Flow-Layout-container-controls.aspx
0
 

Author Comment

by:RIAS
ID: 41831874
Thanks,
But the controls in tabpage are not resizing.
Any suggestions are appreciated.

Cheers
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 41831885
>>But the controls in tabpage are not resizing.

I have forms with tab pages and they are resizing so the problem is definitely not there. But since we don't wee how you set your stuff, we can't fully help you.

One blind guess: have you set the Anchor property for your controls inside the tabpages?
0
 

Author Comment

by:RIAS
ID: 41831892
Yes,
Tried Anchor but they resize and they stick to each other.May be I am doing something terrible wrong
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 41831912
how do you anchor them?

in a traditional application, you often have textboxes at the top and a grid at the bottom. the top controls are usually anchor to left, top  and right (so they stay at the same position but enlarge the width if possible) while the grid at the bottom could be anchor on all 4 sides to use the remaining space.

maybe you would be better with a table flow layout as shown in my article.
1
 

Author Comment

by:RIAS
ID: 41834048
Will try Eric!
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now