Solved

Controls resize depending on the monitor size

Posted on 2016-10-05
7
21 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 39

Expert Comment

by:Kyle Abrahams
Comment Utility
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 69

Expert Comment

by:Éric Moreau
Comment Utility
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
Comment Utility
Thanks,
But the controls in tabpage are not resizing.
Any suggestions are appreciated.

Cheers
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
>>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
Comment Utility
Yes,
Tried Anchor but they resize and they stick to each other.May be I am doing something terrible wrong
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
Comment Utility
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
Comment Utility
Will try Eric!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 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

12 Experts available now in Live!

Get 1:1 Help Now