How to dynamically manage the size of SplitPanels

1 Answer 388 Views
SplitContainer
Laurent
Top achievements
Rank 1
Iron
Laurent asked on 12 Sep 2022, 12:42 PM

Hello,

I have a form with a splitcontainer with 2 splitpanel:
- splitpanelFilter
- splitpanelMain

/* SplitContainerMain */
        /*  */
        THIS-OBJECT:SplitContainerMain:AutoScroll = TRUE.
        THIS-OBJECT:SplitContainerMain:Controls:Add(THIS-OBJECT:splitPanelFilter).
        THIS-OBJECT:SplitContainerMain:Controls:Add(THIS-OBJECT:splitPanelMain).
        THIS-OBJECT:SplitContainerMain:Dock = System.Windows.Forms.DockStyle:Fill.
        THIS-OBJECT:SplitContainerMain:Location = NEW System.Drawing.Point(0, 0).
        THIS-OBJECT:SplitContainerMain:Name = "SplitContainerMain".
        THIS-OBJECT:SplitContainerMain:Orientation = System.Windows.Forms.Orientation:Horizontal.
        /*  */
        /*  */
        /*  */
        THIS-OBJECT:SplitContainerMain:RootElement:MinSize = NEW System.Drawing.Size(25, 25).
        THIS-OBJECT:SplitContainerMain:Size = NEW System.Drawing.Size(644, 480).
        THIS-OBJECT:SplitContainerMain:SplitterWidth = 2.
        THIS-OBJECT:SplitContainerMain:TabIndex = 1.
        THIS-OBJECT:SplitContainerMain:TabStop = FALSE.
        THIS-OBJECT:SplitContainerMain:ThemeName = "Crystal".
        /*  */
        /* splitPanelFilter */
        /*  */
        THIS-OBJECT:splitPanelFilter:Controls:Add(THIS-OBJECT:BtnFilterDown).
        THIS-OBJECT:splitPanelFilter:Controls:Add(THIS-OBJECT:BtnFilterDefault).
        THIS-OBJECT:splitPanelFilter:Dock = System.Windows.Forms.DockStyle:Top.
        THIS-OBJECT:splitPanelFilter:Location = NEW System.Drawing.Point(0, 0).
        THIS-OBJECT:splitPanelFilter:Name = "splitPanelFilter".
        /*  */
        /*  */
        /*  */
        THIS-OBJECT:splitPanelFilter:RootElement:MinSize = NEW System.Drawing.Size(25, 25).
        THIS-OBJECT:splitPanelFilter:Size = NEW System.Drawing.Size(644, 28).
        THIS-OBJECT:splitPanelFilter:SizeInfo:AutoSizeScale = NEW System.Drawing.SizeF(Progress.Util.CastUtil:ToSingle(0), Progress.Util.CastUtil:ToSingle(-0.4393305)).
        THIS-OBJECT:splitPanelFilter:SizeInfo:SplitterCorrection = NEW System.Drawing.Size(0, -192).
        THIS-OBJECT:splitPanelFilter:TabIndex = 0.
        THIS-OBJECT:splitPanelFilter:TabStop = FALSE.
        THIS-OBJECT:splitPanelFilter:ThemeName = "Crystal".
/*  */
/* BtnFilterDefault */
        /*  */
        THIS-OBJECT:BtnFilterDefault:Image = CAST(resources:GetObject("BtnFilterDefault.Image"), System.Drawing.Image).
        THIS-OBJECT:BtnFilterDefault:Location = NEW System.Drawing.Point(3, 3).
        THIS-OBJECT:BtnFilterDefault:Name = "BtnFilterDefault".
        THIS-OBJECT:BtnFilterDefault:Size = NEW System.Drawing.Size(73, 22).
        THIS-OBJECT:BtnFilterDefault:TabIndex = 0.
        THIS-OBJECT:BtnFilterDefault:Text = "Filtres".
        THIS-OBJECT:BtnFilterDefault:TextAlignment = System.Drawing.ContentAlignment:MiddleRight.
        THIS-OBJECT:BtnFilterDefault:ThemeName = "Crystal".
        THIS-OBJECT:BtnFilterDefault:Click:Subscribe(THIS-OBJECT:BtnFilterDefault_Click).
        /*  */
        /* splitPanelMain */
        /*  */
        THIS-OBJECT:splitPanelMain:Location = NEW System.Drawing.Point(0, 31).
        THIS-OBJECT:splitPanelMain:Name = "splitPanelMain".
        /*  */
        /*  */
        /*  */
        THIS-OBJECT:splitPanelMain:RootElement:MinSize = NEW System.Drawing.Size(25, 25).
        THIS-OBJECT:splitPanelMain:Size = NEW System.Drawing.Size(644, 450).
        THIS-OBJECT:splitPanelMain:SizeInfo:AutoSizeScale = NEW System.Drawing.SizeF(Progress.Util.CastUtil:ToSingle(0), Progress.Util.CastUtil:ToSingle(0.4393305)).
        THIS-OBJECT:splitPanelMain:SizeInfo:SplitterCorrection = NEW System.Drawing.Size(0, 192).
        THIS-OBJECT:splitPanelMain:TabIndex = 1.
        THIS-OBJECT:splitPanelMain:TabStop = FALSE.
        THIS-OBJECT:splitPanelMain:ThemeName = "Crystal".


I want to dynamically manage the size of the Split Panels on the click of a button.
I have a variable iHeight= 30.
If I click I increase the height of the SplitPanelFilter by (28 + iHeigth) and I decrease the height of the SplitPanelMain (450 - iHeigth)
And conversely when I click again on the button ==> default position

I use this command
THIS-OBJECT:SplitPanelMain:Height= 450 - iTaille.
THIS-OBJECT:SplitPanelFilter:Height= 28 + iTaille.
but nothing ....
Are you a solution ??

Thank you

Laurent TROMBINO

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Sep 2022, 08:40 AM

Hello, Laurent, 

In order to control the size of RadSplitContainer and the SplitPanels inside it, it is necessary to specify the SizeInfo.SizeMode property to Absolute and then set the SizeInfo.AbsoluteSize property to the desired size. The following help articles demonstrates a sample approach how to define RadSplitContainers with specific size for its SplitPanels:

https://docs.telerik.com/devtools/winforms/controls/splitcontainer/building-a-layout-of-radsplitcontainers-programmatically 
https://docs.telerik.com/devtools/winforms/controls/splitcontainer/building-advanced-layouts 

Feel free to use a similar approach in your project. 

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Laurent
Top achievements
Rank 1
Iron
commented on 14 Sep 2022, 11:56 AM

Merci pour l 'info, mais j’avais déjà vu l’info. Juste

Je cherche un exemple de code dynamique.

Dess | Tech Support Engineer, Principal
Telerik team
commented on 16 Sep 2022, 01:39 PM

Hi, Laurent, I would like to note that the official language for communication in the forum is English. Thank you in advance for your understanding.

As to the RadSplitContainer, there is not dedicated example of how to adjust dynamically the sizes since it is a subject of custom development according to the specific requirement that you are trying to achieve. Note that it is just necessary to calculate what size to be set to the SizeInfo.AbsoluteSize property for the split panels when the parent container is resized

Tags
SplitContainer
Asked by
Laurent
Top achievements
Rank 1
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or