DevExpress: Layout Control in C#
By FoxLearn 6/21/2017 9:20:41 PM 5.94K
How to use DevExpress Layout control in C#
Step 1: Click 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
Step 2: Design your form as below
If you have not yet installed DevExpress .NET products, you can view How to download and install DevExpress
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
Categories
Popular Posts
Visual Studio: Auto increment version
04/01/2024
What is ARM architecture?
04/01/2024
What Are RESTful Web Services?
02/19/2024