Home > Article > System Tutorial > Analysis of the basic steps of devexpress winform interface development
After installing DevExpress, the steps to develop a DevExpress form application are as follows:
1) Use the wizard template provided by DevExpress to create a DevExpress Winform project
2) After establishing the project, you can see the various form controls provided by DevExpress
3) Drag a command button SimpleButton into the form and change its Text property to "Close"
4) Double-click the command button to write the background code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DXApplication3
{
public partial class Form1 : DevExpress.XtraEditors.XtraForm
{
public Form1()
{
InitializeComponent();
}
private void simpleButton1_Click(object sender, EventArgs e)
{
// close the window
this.Close();
}
}
}
5) Run to display the DevExpress style form. Click "Close" to close the window
In order to keep the style consistent, of course drag the checkbox in devexpress to the header of the gridview's checkbox column, treat it as a full selection box, and then set the maximum width and minimum width of the gridview's checkbox column to 20 . This eliminates the step of drawing a select-all box. As a final reminder, there is no need to make any settings for the check box column. The following code is the step to add the checkbox select all function and get the value.
The first simple but most important step is to add a custom column to the data source bound to the gridview. This is when you will find that the checkbox column of the gridview automatically becomes a checkbox
In the second step, the checkbox column of the gridview is assigned values cyclically in the event of the checkbox control. This implements the function of selecting all or not selecting all
The third step is to get the value of the row where the check box is selected
1. Add a row of data to the data source that you want to bind to the gridview
DataTable dt = GetDataSource();
dt.Columns.Add("check", System.Type.GetType("System.Boolean"));
gridControl1.DataSource = dt;
2. Add the following code in the CheckedChanged event of the gridview's all-select box to achieve the all-select effect:
private void checkEdit1_CheckedChanged(object sender, EventArgs e){for (int i = 0; i 3. Get the data result of the selected row
private void GetCheck(){string value = ""; //Variable, stores the selected value of the row
string strSelected = ""; //The desired result. Can be of any type
Okay, the same, but traversing the DEV control is very simple. There is a problem when it comes to the caption. There are only two columns in the middle of the table, namely name and text. If a caption is specified in the xml, it will prompt that the object setting is not referenced to the instance. , I am also very confused at the moment and don’t know what to do
if (control.GetType() == typeof(DevExpress.XtraEditors.PanelControl))
GetSubControls(control.Controls, table);
if (control.GetType() == typeof(DevExpress.XtraEditors.GroupControl))
GetSubControls(control.Controls, table);
if (control.GetType() == typeof(DevExpress.XtraBars.Ribbon.RibbonPage))
GetSubControls(control.Controls, table);
if (control.GetType() == typeof(DevExpress.XtraBars.BarButtonItem))
GetSubControls(control.Controls, table);
In this way, you can traverse to the DEV control, but there is currently no solution for the value of the caption
The above is the detailed content of Analysis of the basic steps of devexpress winform interface development. For more information, please follow other related articles on the PHP Chinese website!