Virtual basic Full screen resizing - vb.net

I'm making a full screen application in visual basic and is having some issues with full screen and control resizing.
I've looked around both google, stack overflow and youtube for answers but none seems to be working for me. What I have worked my way to is that i need to use anchor or docking or something like that if I am not all incorrect
Edit:
Picture examples:
The main window in my editor.
When the program runs in maximized screen
Resolution of the program is 800x600 as its going to be made for a screen with that resolution.

You probably want to use anchor points. You can anchor a control to any side, all sides, or any combinations of sides in its container (the form, usually). When the form is resized, the control is automatically sized accordingly. You can also use the form's resize event and change the size or location of the controls manually when the form size changes.

Related

Make Form Maximized, but not Full Screen

I would like to make my Form1 Maximized, but not Full Screen, as differentiated by Maximized taking the entirety of the screen while leaving space dedicated to the Taskbar at the bottom. To clarify, I'd like my application to work how other applications traditionally work, such as Chrome or the MS Office suite when maximized. Definitely nothing fancy.
To make my application resize itself dynamically, I've calculated where buttons will fit relative to the height and width of the application. However, I discovered quickly that my application, in Maximized state, actually continued underneath the task bar (or, in reverse, the taskbar is entirely cut off by the application - it is Full Screen). My bottom-most buttons are actually cut off by the taskbar. After experimenting with different Form settings, I discovered this appears to be entirely the result of WindowState = FormWindowState.Maximized setting.
I've tried various routes to counteract this behavior. First, I attempted to resize the maximum bounds programmatically, while leaving the Form's MaximumSize set to "0,0" (the default "resize me as needed" setting). I have this code in the Form_Load event:
Me.MaximizedBounds = Screen.PrimaryScreen.WorkingArea
and
Me.MaximizedBounds = Screen.FromHandle(Me.Handle).WorkingArea
However, these did not have any affect, even though the working area height is confirmed smaller than the form height. In fact, upon further testing, I have not been able to programmatically change the maximizedbounds at all, apart from manually in the form properties, setting the MaximumSize to 100,100. Does anyone have suggestions here?
I also tried to change the WindowsState = FormWindowState.Manual and readjust the form height this way:
Width = Screen.PrimaryScreen.WorkingArea.Width
Height = Screen.PrimaryScreen.WorkingArea.Height
Which makes the form closer to the dedicated dimensions, but makes the window movable and no longer covers the entirety of a traditionally maximized screen (it leaves about 20 pixels padding on all sides).
In the end, I'm at a bit of a loss on how to do this and would really appreciate some clarification. I have attempted other code I'd be glad to share, as well as similar questions on the forum, but none have helped me get my targeted behavior. I have a locked Taskbar on the most recent update to Windows 10, if those details make any difference.

'Pause' Display while control elements are updated (VB.Net)

So, I am kind of asking a question for a hypothetical situation here.
I am producing a Windows Form App made to show multiple windows of data on the screen at the same time. To accomplish this, I have decided to put a Table Layout Panel in the main form to act as a container for all of the data windows I will open.
The width and height of each cell of the Table Layout Panel will change depending on how many windows are open. For example, if just one window is open, it takes up 100% of the width and height of the container area. Alternatively if 3 windows are open, all the windows will have a size equal to 50% of the container's width and height.
Now let's assume each of these Windows have 20 different control elements, which are all used to help the user search through the data shown in each window. Additionally, all of these elements dynamically resize and relocate themselves as the dimensions of the window they are in change.
With all of these moving elements, when a screen is added or removed it can be assumed that there will be a good deal of glitching going on on the screen that may alarm the user. Thus we get to my question.
Is there a way to 'pause' the display of a Windows Form Application so that the user doesn't see everything on change modifying itself? I can't seem to find anything like while looking online so that is why I am asking here.

Automatically adjusting winform and controls to screen size

I created a winform application. The size of each screen is 1361, 768 in pixels. This worked great for larger screens and/or laptops. But now I have to move my application to 10inch screen tablets, which means my application does not fit.
I have never had to deal with this issue before, how can auto adjust each form size and adjust all of the controls and panels when viewing on smaller screens?
I am using VS 2012.
Making forms fully scalable in WinForms is possible, but it takes a bit of work. The good news is that most of this work is done at design-time, arranging the controls properly so that everything is done for you automatically by the framework. It's drudgery, but it isn't difficult. Rejoice that you don't have to write the scaling code by hand, form-by-form, like you did with VB 6.
There are four fundamental properties that you will need to acquaint yourself with:
Anchor
Dock
Margin
Padding
The last two should be quite familiar web developers who know CSS—they do the same thing here. Padding controls the inner margin around a control, while margin controls the outer margin. You will need to set these correctly to ensure that your controls can "breathe", because the automatic scaling code is just going to jam them up against one another.
The "standard" margins around a control in a Windows desktop application are approximately 12–15 pixels. You should make sure that you leave at least this much room. Then add additional margins/padding as you see fit to separate things. I keep these layout specifications bookmarked for reference. This is another good reference.
The next step is to instruct the layout manager how you want the controls to be arranged and resized. The key to this is to think in terms of container controls and child controls. The form itself is a container control, and you can set its child controls to either Anchor or Dock within its boundaries. One or more of those child controls can itself be a container control, and its child controls can be Anchored or Docked within its borders. The nesting is virtually unlimited, but for your own sanity and reasonable redraw performance, you'll want to keep it to a reasonable minimum.
A good way of doing this is to use the two provided invisible layout helpers, FlowLayoutPanel and TableLayoutPanel. Personally, I don't find the former very useful very often, at least not for standard Windows applications. But the TableLayoutPanel is invaluable.
Generally what I will do is fill my entire form with a TableLayoutPanel (margins = 0, dock = fill). Then I will add individual controls (or sometimes another nested TableLayoutPanel) to its cells. Those child controls will have their margins set appropriately, and will have either their Anchor or Dock properties set, depending on whether I want that control to have a fixed size or resize dynamically.
Before you get the hang of how these properties interact and how it all works, you'll probably need to play around with your layout a bit. Make a backup of your forms and then just dig in. Or, you might find it easier to start designing each form from scratch (you can still copy-and-paste individual controls in order to preserve their other properties). Eventually, it will all start making sense to you, and you'll be up and going in a jiffy.
The great thing is, once this is all set up, all you have to do is ensure that your form is resizable. Then, whether the user manually resizes it or uses the maximize/restore button, it'll automatically fill their screen size. This also works well for all DPI settings, which is another common Achilles' heel of WinForms devs.
Try to get the resolutions variables to adjust your screens, there is an answer to get these variables using the Screen class
Getting Screen Resolution
DevExpress has a great control call the Layout Control. This control helps to maintain consistent whitespace between controls as the form is resized. It does take a little study to use the control effectively but once you understand how to use this control the results are consistent and you are able to speed through form design.

how to resize or reposition controls based on screen resolutions in VB.NET

I making a Windows application with VS2010. Where i'm using panels to fight with different screen resolutions.
For some of my controls I used anchor property set to top,bottom without docking them to parent panel. when i run this program on the machine which is used to develop, result was as expected,But when i tried this one on different resolution its results were worse than expected. Some controls are partially displayed.
I found a solution here to this by re-sizing my controls based on screen resolutions. But that didn't worked for me as controls were re-sized but they were out of display area.
I couldn't relocate them based on resolution.
how would i set their position based on resolution.
or
i should assume minimum screen resolution (lets say 800*600) and program with this resolution.
Plz help!
I thought the solution was to use TableLayoutPanel and panels to do this.
I was bit right, but this doesn't work in all the cases.
Found a solution here https://stackoverflow.com/questions/2802015/....
Cheers..!

Controls change place and form size changes

I have designed a form in VB.NET. At design time I have placed two buttons on it.
When I run it, the form size looks smaller and the buttons I have placed at the bottom are not visible. Also the alignment of the text and picture box is also different from what I set at design time.
Computer at which I am running the form is using a different resolution.
change the properties (F4) of the buttons: in ANCHOR put Bottom, Right
your buttons will be tied to the bottom and the right of the screen, instead of to the top, left, which is the default.
Grab the screen size at runtime with
Dim screen as System.Windows.Forms.Screen = System.Windows.Forms.Screen.PrimaryScreen
and using a scale factor depending on the current size (in design), scale the window to match. Check the coordinates of the buttons by hand to make sure they are not outside of the visible portion of the window.
You may not have to leave this feature in if you can debug it to the point that you know the exact resolution that you need.