Hello group!

I've seen one short discussion of ensuring that the controls within a form will shrink, grown and stay in their proportional position as the user changes the form size. Unfortunately it covered parent/child forms, etc. It didn't make a lot of sense to me.

Ultimately I do want the user to see the form as pleasing regardless of the form size. Are there settings in the form properties that will allow the controls, labels, etc., to shrink and grow as the form size changes? Will these controls and labels stay in their relative position as the form size changes? If so, what are the specific settings that I should use?

Thanks for your help.

Don

You can change the width or height of controls and follow the form width or height.
Use Form resize event to make it works.
Eg :

    Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        TextBox1.Width = Me.Width - 40
    End Sub

Edited 3 Years Ago by Jx_Man

Jx_Man,

Let me ask, are you saying here that as the user changes the form size, the code you've written will allow everything within the form to change sizes?

I was hoping there was a property setting within the form that would allow this to happen. If there isn't, I don't mind writing some code that will do it. But I do want to ensure the format of the controls within the form will stay in their general location/alignment and will shrink and grow as the form size changes.

As I'm designing my forms, most of these are sized at 1600 X 900 (my screen size). I recognize that other screen sizes will be different. I want to ensure everything will remain proportional as I've designed it. Will the above code do this?

Thanks for your help!

Don

Jx_Man,

I've tried your code. It doesn't seem to be doing anything that I was attempting. I wrote it as follows

Private Sub PrinterControl_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        lvPrinterSetup.Width = Me.Width - 40
        Label1.Width = Me.Width - 40
        Label2.Width = Me.Width - 40
        Label3.Width = Me.Width - 40
        Label4.Width = Me.Width - 40
        Label5.Width = Me.Width - 40
        Label6.Width = Me.Width - 40
        Label7.Width = Me.Width - 40
        txbLoc.Width = Me.Width - 40
        txbPrinterAddress.Width = Me.Width - 40
        txbPrinterName.Width = Me.Width - 40
        txbPrinterNo.Width = Me.Width - 40
        txbRow.Width = Me.Width - 40
        btnClearLine.Width = Me.Width - 40
        btnDeleteLine.Width = Me.Width - 40
        btnReturnToMenu.Width = Me.Width - 40
        btnUpdateFile.Width = Me.Width - 40
    End Sub

It appears that the controls (more so the buttons) grew to inside the form when it opened. I've futher discovered that the form couldn't be resized by using the mouse to grab a corner to shrink it (is this a setting in the form's properties?).

Again, thanks for the help. Any other thoughts?

Don

This question has already been answered. Start a new discussion instead.