Increasing the space inside a windows form - vb.net

I am trying to populate my windows form with new controls and data based on what is read from my database. The left side of the form is a static panel which will not need re sizing but I need to create multiple labels on the right side which requires more space. I added the vscroll control but am having trouble increasing the size of the right side of the form.

To use a scroll-bar will require a semi-low-level implementation where you need to always update the view by repositioning the elements, calculating your scroll-bar in relation to total view, what elements would be visible and so forth.
A better solution in this case will probably be to add a Panel control on the right which is docked (f.ex. Fill) and then set the AutoScroll property to True.
This way you leave all the "low level" stuff to the Panel control and you can add and position the elements you need to the Panel's Controls collection instead.

Related

How to disable Sap Business One form's default resizing behavior?

I'm developing the custom UI layout system for our custom SBO forms. I.e. catching form's resize event and arranging the controls according to our specific layout logic. The problem is that, apparently, SBO tries to arrange controls according to its (clunky and primitive) logic on every form resize first! My code handling the resize event and rearranging the items works, but there is a noticeable performance delay, as items are essentially re-positioned twice on each form resize - once by SBO itself, and then by my code.
Is there any way to stop SBO arranging controls on our custom forms during resize, so that they will be positioned only once by my code (in the resize event handler)?
This page by Boyum IT helps to explain what the resizing rules are.
There's additional information on this page
To summarize those pages, every form is split into 4 quadrants, which are effectively pinned to the corners of the form that they belong to.
That means that as you resize the form, these quadrants separate from each other, leaving large sections of space between them.
I don't believe that there's an easy way to prevent this behavior out of the box, but you can manually override it using the B1 UI API, by setting the LinkTo property of the Items to match the ID of one of the Items in the top left quadrant, which causes the given item to move with the same behavior as that of the item specified in LinkTo.

What technique will I use if i want to change this panel when I click a button in VB

I just have it in my mind. And I can't explain it so here it goes.
A system that only uses 1 form?
It have a two panel, left and right.
The left is consist of buttons
Then the right is associated on the buttons and will change whether what button will be clicked.
Any ideas?
My preference is to do this via custom controls, rather than panels... but panels can work too.
There are a number of ways to do this:
Keep all of the controls layered on top of each other, and then set the Visible property to false for controls/panels you don't care about and to true for the Control/Panel that you do
Move the controls you don't care about out of the visible area
Remove/Add the Controls/Panels from Form's controls collection entirely
I think you can also get a TabControl to put the tabs along the left side, with some formatting that looks more like buttons, such that what you want will be handled without needing to write any code to switch layouts
Any of those can work. Whichever option you use, I have two recommendation for controlling layout and making the transitions smooth.
Call SuspendLayout() before making any changes, and then call ResumeLayout() when you're done. This will help avoid stuttering or a partially rendered form.
Look at the TableLayoutPanel Control. This control will allow you to arrange your top-level panels so that they can be resized with proportion. If you also then dock your individual panels, you can quickly build your program so that it resizes correctly.
You can have several panels, one on top of another. Change their visibility, depending on which one you need at a given moment.
Option #2 would be using a vertical tab control (or a tab strip - see another answer there).

vb net: zoom in designer

I was searching google for a way to size the form and the controls with it and came across something that mentioned Control.scale. How do I use the control.scale method to size everything down to the way I want it.
Also, is there a way I can zoom the form out in the designer. I want to create a 1280X800 form, but my screen is 1024X768. I want to be able to zoom out to see the entire form wile still having it's size be 1280X800.
You can use tablelayout panel in order to fit your form in all resolutions.similary a property called anchor, which is also need to be assigned for the controls inside tablelayout panel according to your requirement [top,bottom,left,right] to achieve the same.
By the way you have to use percentage for setting the column's width and row's height in that.
Simply, this way of designing is called as fluid designing.
Table layout panel

winforms - usercontrol with dockstyle fill not correct size during form load

My main form has two panels, left docked and right docked. The right side panel has two child panels with top dock and bottom dock settings. The usercontrol is added to the right side top panel.
My usercontrol has a panel and a label. The panel is anchored on all 4 sides, the label is anchored on all except the bottom. At runtime I create this usercontrol and set it to dockstyle=fill and then I add it to my top right panel.
With everything set to "fill" I expect that when I add my usercontrol to the panel it will take on the appropriate width and height and pass that info to the child controls (labels) inside of my usercontrol.
My problem is that this stretching of the size does not happen when I create my objects during the Load event on my usercontrol. Even though initializecomponent has ran for the usercontrol the panel inside of it (4 corners anchored) has not taken the x/y values of the available space. As a result my usercontrol shows up about 50% of the width I want.
Lets say that instead of creating objects during usercontrol load that I instead start a timer and have the timer call my create routine when it raises the tick event. When I do things like this my objects are created with the full width/height that I expect. The only issue here is that this causes a delay in my interface.
Can someone help explain this behavior? My mainform is calling a "load gui" routine which is instantiating usercontrols, setting panel sizes, and then adding usercontrols to those panels. This particular user control is the last to load into the panels from that load gui routine so it does not make sense that the parent panel width/height would not be known yet. This is one of my first apps where I am purposely trying to use dockstyle=fill to keep things consistent across different main form sizes without writing all the extra size_changed code handlers. I'm sure this one is easy to work around once I know where the problem lies.
Thanks for any help provided!
this turned out to be a padding issue on the parent usercontrol. I also had to allow a bit of wiggle room to make sure that the controls didn't overflow the panel so I did a parent.width - 15 and that along with the padding made everything work much better.

Grow / Zoom VB.NET Form

Is there an easy way to grow / zoom a VB.NET application and all controls within it to fill a larger screen resolution (or must I adjust each form element individually)?
NOTE: Adjusting the resolution back is not a permanent (or preferred) option in this case.
Please don't design your forms so they always fill the screen. Your customer has bought that nice expensive monitor to see more windows, not more of your form.
A well designed form is otherwise always resizable. Use the Anchor and Dock properties, TableLayoutPanel and FlowLayoutPanel to ensure that your controls move and size themselves properly. If your customer wants it big, she'll just click the Maximize button.