3 Answers, 1 is accepted
1
Hi Wiktor,
Thank you for writing.
RadSplitContainer does not support such functionality out of the box, however, you can easily implement it by saving and loading the size of the SplitPanels using their SizeInfo property. Here is a sample, which is using the application configuration to save the layout in a StringCollection:
I hope this information helps. Should you have any other questions, I will be glad to assist you.
Regards,
Dimitar Thank you for writing.
RadSplitContainer does not support such functionality out of the box, however, you can easily implement it by saving and loading the size of the SplitPanels using their SizeInfo property. Here is a sample, which is using the application configuration to save the layout in a StringCollection:
using Lab.Properties;using System.Drawing;using System.Windows.Forms;using Telerik.WinControls.UI; namespace Lab.Dock{ public partial class SplitSaveLoadLayoutForm : MainForm { private RadSplitContainer splitContainer = new RadSplitContainer(); public SplitSaveLoadLayoutForm() { InitializeComponent(); splitContainer.Dock = DockStyle.Fill; splitContainer.Parent = this; splitContainer.BringToFront(); for (int i = 0; i < 4; i++) { splitContainer.SplitPanels.Add(new SplitPanel()); } } protected override void OnButton1Click() { Settings.Default.SplitPanes = new System.Collections.Specialized.StringCollection(); foreach (SplitPanel panel in splitContainer.SplitPanels) { string size = string.Format("{0}:{1}", panel.Size.Width, panel.Size.Height); Settings.Default.SplitPanes.Add(size); } Settings.Default.Save(); } protected override void OnButton2Click() { if (Settings.Default.SplitPanes == null) { return; } int index = 0; splitContainer.SuspendLayout(); foreach (var item in Settings.Default.SplitPanes) { splitContainer.SplitPanels[index].SizeInfo.SizeMode = Telerik.WinControls.UI.Docking.SplitPanelSizeMode.Absolute; splitContainer.SplitPanels[index].SizeInfo.AbsoluteSize = Parse(item); index++; } splitContainer.ResumeLayout(true); } private Size Parse(string size) { string[] sizeParts = size.Split(':'); int width = int.Parse(sizeParts[0]); int height = int.Parse(sizeParts[1]); return new Size(width, height); } }}I hope this information helps. Should you have any other questions, I will be glad to assist you.
Regards,
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Bill
Top achievements
Rank 1
answered on 13 Jun 2017, 06:42 PM
I was able to implement a VB.NET solution for my 4 panel dashboard display (2 rows x 2 columns using 3 RadSplitPanels) using your help. Thanks. Couldn't have done it without this.
One thing though... in the Parse() method you have the height and width variables backwards, right? When saving the data it's "width:height" but the names of the variables in Parse() makes it look like you read the height out first. But it works because the Size() constructor is expecting the width first. Perhaps two wrongs actually do make a right... if I'm reading this code correctly.
0
Hello Bill,
Yes, indeed you are correct. I will change this when possible.
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
Yes, indeed you are correct. I will change this when possible.
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
