• Top Members
    Reps
    Posts
  • 834 Replies
    2585 Replies
  • 716 Replies
    2026 Replies
  • 331 Replies
    1928 Replies

Resizing FlowLayoutpanel Within Controls

Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
User avatar
Dummy1912
VIP - Donator
Posts: 1998

Resizing FlowLayoutpanel Within Controls

Sat Aug 31, 2019 1:04 pm

Hello,

I was wondering if someone can provide me an example
for resizing flowlayoutpanel with his controls inside
to bring the best fit on the form

Even when you maximized the form
i can't find any solution for this problem even if we even use dock option

Thank you

-Dummy

User avatar
CodenStuff
Site Admin
Posts: 4386

Re: Resizing FlowLayoutpanel Within Controls

Sun Sep 01, 2019 10:45 am

docking the flowlayoutpanel to fill the parent container should work. If you want the child controls to also adjust when the flowlayoutpanel resizes you would have to dock those also.

All dependant on how you have everything laid out and how you want it to expand/adjust :duh;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.

User avatar
Dummy1912
VIP - Donator
Posts: 1998

Re: Resizing FlowLayoutpanel Within Controls

Sun Sep 01, 2019 10:51 am

Hello,

yea using the dock option isn't a solution
and the child controls using the dock option isn't working as well

isn't there any way to resize how it should be? without any hard options
because search a lot and can't find anything
even some said writing your own thing but the ones that did it
well lets say it has the same results as the dock option :Ooor;

User avatar
CodenStuff
Site Admin
Posts: 4386

Re: Resizing FlowLayoutpanel Within Controls

Sun Sep 01, 2019 11:13 am

Do you have an image or something to show what you're trying to accomplish?

I don't fully understand what you're wanting to do lol
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.

User avatar
Dummy1912
VIP - Donator
Posts: 1998

Re: Resizing FlowLayoutpanel Within Controls

Mon Sep 02, 2019 4:42 am

Hello,

some screens
screen 1 will show normal state
screen 2 will show maximized state
as you can see the inside child's are not resizing

any idea?

https://photos.app.goo.gl/LwvGzePgmWFFgmDw9

User avatar
CodenStuff
Site Admin
Posts: 4386

Re: Resizing FlowLayoutpanel Within Controls

Tue Sep 03, 2019 6:55 am

You would have to resize all the child controls yourself. Do something in flowlayoutpanel resize event like:

Its a bit early in the morning and my brain isn't working yet so hopefully you can fill in the blanks:

Code: Select all

for each ChildControl as control in Flowpanel
childcontrol.width = (flowpanel.width / NumberOfControlsInFlowPanel)
next
So effectively you need to know how many controls are in the flowlayoutpanel then adjust their width based on flowlayoutpanel width divided by the number of controls.

Hope that makes sense :duh;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.

User avatar
Dummy1912
VIP - Donator
Posts: 1998

Re: Resizing FlowLayoutpanel Within Controls

Wed Sep 04, 2019 3:23 am

:nersmile
you are an angel :lover;

just what i needed
my custom changes are:

Code: Select all

            For Each ctl As Control In PetesFlowLayoutPanel1.Controls
                If TypeOf ctl Is PetesLib.FlowLayoutPanel.PetesFlowLayoutPanel Then
                    If CType(ctl, PetesLib.FlowLayoutPanel.PetesFlowLayoutPanel).Name.StartsWith($"flDay") Then
                        ctl.Width = ctl.Width + 48
                    End If
                End If
            Next

Thanks :wink;

User avatar
Dummy1912
VIP - Donator
Posts: 1998

Re: Resizing FlowLayoutpanel Within Controls

Wed Sep 04, 2019 6:08 pm

Hi Again,

i don't get it everything works like a charm with the previous code
but when i try to do this inside the flowpanel to resize the linklabel
nothing happens

Code: Select all

For Each ctl As Control In PetesFlowLayoutPanel1.Controls
                If TypeOf ctl Is PetesLib.FlowLayoutPanel.PetesFlowLayoutPanel Then
                    If TypeOf ctl Is PetesLib.Theme.PetesLink Then
                            ctl.Width = ctl.Width + 48 'nothing happens ???
                    End If
                    End If
            Next

or even this

Code: Select all

For Each ctl As Control In PetesFlowLayoutPanel1.Controls
                If TypeOf ctl Is PetesLib.FlowLayoutPanel.PetesFlowLayoutPanel Then
                    If TypeOf ctl Is PetesLib.Theme.PetesLink Then
                        If CType(ctl, PetesLib.Theme.PetesLink).Name.StartsWith($"link") Then
                            ctl.Width = ctl.Width + 48 'nothing happens ???
                        End If
                    End If
                    End If
            Next

any idea's

User avatar
Dummy1912
VIP - Donator
Posts: 1998

Re: Resizing FlowLayoutpanel Within Controls

Wed Sep 04, 2019 6:56 pm

:teehe;

got it

Code: Select all

For Each ctl As Control In PetesFlowLayoutPanel1.Controls
                If TypeOf ctl Is PetesLib.FlowLayoutPanel.PetesFlowLayoutPanel Then
                    For Each ctr As Control In ctl.Controls
                        If TypeOf ctr Is PetesLib.Theme.PetesLink Then
                            ctr.Width = ctr.Width + 48
                        End If

                    Next
                End If
            Next
            
Sweet :nersmile

Post Reply

Return to “Tutorial Requests”