DevExpress: Layout Control in C#

How to use DevExpress Layout control in C#

Step 1Click New Project, then select Visual C# on the left, then Windows and then select Windows Forms Application. Name your project "LayoutControlDemo" and then click OK

devexpress layoutStep 2: Design your form as below

If you have not yet installed DevExpress .NET products, you can view How to download and install DevExpress

c# devexpress layout

Step 3: Add code to handle your forms as below

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.IO;

namespace LayoutControlDemo
{
    public partial class XtraForm1 : DevExpress.XtraEditors.XtraForm
    {
        public XtraForm1()
        {
            InitializeComponent();
        }

        private void XtraForm1_Load(object sender, EventArgs e)
        {
            //Load layout from xml file
            string fileName = string.Format("{0}/{1}.xml", Application.StartupPath, this.Name);
            if (File.Exists(fileName))
                layoutControl1.RestoreLayoutFromXml(fileName);
        }

        private void btnSaveLayout_Click(object sender, EventArgs e)
        {
            try
            {
                //Save layout to xml file
                layoutControl1.SaveLayoutToXml(string.Format("{0}/{1}.xml", Application.StartupPath, this.Name));
            }
            catch(Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}

VIDEO TUTORIALS