This case shows the display data of Dev gridcontrol and chartcontrol,
Gridcontrol control:
1. Bind The ilist <t> object,
2. Select All,
// Click the Select All button to obtain the method <br/> private void checkedit1_checkedchanged (Object sender, eventargs E) <br/>{< br/> try <br/> {<br/> listp = gridcontrol1.datasource as ilist <perf_cell_g>; <br/> for (INT I = 0; I <listp. count; I ++) <br/>{< br/> perf_cell_g P = listp [I] As perf_cell_g; <br/> P. check = checkedit1.checked; <br/>}< br/> gridcontrol1.refreshdatasource (); <br/>}< br/> catch (exception) <br/>{</P> <p >}< br/>}
3. Delete multiple selected rows,
/// <Summary> <br/> // Delete the data of the selected row <br/> /// </Summary> <br/> // <Param name = "sender"> </param> <br/> // <Param name = "E"> </param> <br/> private void simplebutton2_click (Object sender, eventargs e) <br/>{< br/> List <string> selectedrows = new list <string> (); </P> <p> listp = gridcontrol1.datasource as ilist <perf_cell_g>; <br/> for (INT I = 0; I <listp. count; I ++) <br/>{< br/> perf_cell_g P = listp [I] As perf_cell_g; </P> <p> If (P. check. tostring (). tolower () = "true") <br/>{< br/> selectedrows. add (P. check. tostring (); <br/>}</P> <p >}< br/> If (dialogresult. OK = MessageBox. show ("are you sure you want to delete this template? "," Prompt ", messageboxbuttons. okcancel, messageboxicon.) <br/>{< br/> MessageBox. show (string. format ("{0} selected data to be deleted", selectedrows. count); <br/>}< br/> // Delete the selected row <br/>}
4. display the total calculation sum of all data in a column and the total number of records in a column in the descending direction of gridcontrol,
// Set attributes </P> <p> This. gridcolumn2.summaryitem. displayformat = "Total number of records = {0}"; <br/> This. gridcolumn2.summaryitem. fieldname = "china_name"; <br/> This. gridcolumn2.summaryitem. summarytype = devexpress. data. summaryitemtype. count;
5. For data> 3300 in a column, the special color of the column is displayed,
Method 1 (write method ): <br/> /// <summary> <br/> // The row cell style. If you change the column value to greater than 3300, highlight the column in the CI column. <br/> // /</Summary> <br/> /// <Param name = "sender"> </param> <br/> /// <Param name = "E"> </param> <br/> private void gridview1_rowcellstyle (Object sender, devexpress. xtragrid. views. grid. rowcellstyleeventargs e) <br/>{< br/> try <br/>{< br/> If (E. column. fieldname! = "Ci") <br/> return; </P> <p> string CIV = gridview1.getlistsourcerowcellvalue (E. rowhandle, E. column. fieldname ). tostring (); // obtain the value of the Ci column <br/> If (Civ. trim ()! = "") <Br/>{< br/> If (convert. toint32 (CIV)> 3300) <br/>{< br/> devexpress. utils. appearancehelper. apply (E. appearance, apptype1 ); <br/>}< br/> catch {}< br/>}</P> <p> method 2 (attribute setting gridview1 attribute): <br/> styleformatcondition1.appearance. backcolor = system. drawing. color. fromargb (INT) (byte) (255), (INT) (byte) (255), (INT) (byte) (128); <br/> styleformatcondition1.appearance. backcolor2 = system. drawing. color. fromargb (INT) (byte) (255), (INT) (byte) (255), (INT) (byte) (192); <br/> styleformatcondition1.appearance. forecolor = system. drawing. color. black; <br/> styleformatcondition1.appearance. gradientmode = system. drawing. drawing2d. lineargradientmode. vertical; <br/> styleformatcondition1.appearance. options. usebackcolor = true; <br/> styleformatcondition1.appearance. options. useforecolor = true; <br/> styleformatcondition1.column = This. gridcolumn4; <br/> styleformatcondition1.condition = devexpress. xtragrid. formatconditionenum. greaterorequal; <br/> styleformatcondition1.value1 = "3300"; <br/> This. gridview1.formatconditions. addrange (New devexpress. xtragrid. styleformatcondition [] {<br/> styleformatcondition1 });
6. Hide the upstream English characters in the gridcontrol table
7. You cannot edit columns except check columns in gridcontrol.
Chartcontrol control:
1. Click gridcontrol. A column in this row is displayed in the following table: chartcontrol)
2. Select the value of a column in the row based on gridcontrol, and change the title of the graph to the value of the column accordingly.
Splittercontrol is used to split two controls
//
// Splittercontrol1
//
This. splittercontrol1.dock = system. Windows. Forms. dockstyle. bottom;
This. splittercontrol1.location = new system. Drawing. Point (0,336 );
This. splittercontrol1.name = "splittercontrol1 ";
This. splittercontrol1.size = new system. Drawing. Size (1028, 6 );
This. splittercontrol1.tabindex = 1;
This. splittercontrol1.tabstop = false;
Slice: