1: Remove the "Drag a" column header on the GridView header here to the group by that column "
-click Run Designer to find: Optionview, Showgrouppanel: set to false;
2: How to display the search function that the GridView comes with
-click Run Designer to find: Optionsfind, alwaysvisible: set to True
3: How to resize the GridView size of the form
--Right-click the GridView control, properties, locate Dock: set to Fill
4: How to change the "bound value" of the GridView when the GridView data source has changed
Code Note: The fact is that you re-created an instance of the GridView.
1 gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView (gridControl1); 2 Gridcontrol1.mainview = Gridview1;3 GridView 1.optionsview.showgrouppanel = false;4 GridView1.OptionsFind.AlwaysVisible = true;5 gridcontrol1.datasource = DT;
5: Add checkbox check box in Gridcontrol
--Add a column (if not) to columns, run designer, GridView, and then set
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6E/E0/wKioL1WKix2wkmEmAAMoRpe9Zo4699.jpg "title=" 241018300724116.jpg "alt=" Wkiol1wkix2wkmemaamorpe9zo4699.jpg "/>
--> Also when we need to dynamically bind the grid data, the name of the column in the DataTable will be ported to the name of the filename we set in the GridView, otherwise the data will not be displayed.
6: Make GridView row non-editable
--> Optionsbehavior, Editable:false, Run Designer
7: Adding button buttons to the GridView row
Public void buttoninitial () { RepositoryItemButtonEdit rib = new Repositoryitembuttonedit (); rib. texteditstyle = texteditstyles.hidetexteditor; rib. Buttons[0]. kind = buttonpredefines.glyph; rib. buttonclick += rib_buttonclick; rib. Buttons[0]. caption = "Detailed information"; rib. Buttons[0]. visible = true; gridview1.columns["Downstate"]. Columnedit = rib; &nbsP; } void rib_buttonclick (Object sender, buttonpressedeventargs e) { int rowindex = Gridview1.focusedrowhandle; datarow row = gridview1.getdatarow (rowindex); }
the trigger event is not available after the 8:girdview line adds button buttons.
Set the GridView Editable to True so that the GridView can be edited, and if you do not want it editable, set it in a column of columns. The reason is that the GridView is set to non-editable, Then the mouse click button that column is only selected, no triggering events.
9:gridview Set the color of the selected row
Gridview:run Designer, Appearences:selectrow & Focusedrow (two items to set)
Backcolor:mediumslateblue background Color
Forecolor:white Foreground Font Color
10:gridview Set header row color
Gridview:run Designer--Appearences:headpanel In this attribute group are all about the header row settings, again do not interpret.
When the Headpanel is not finished, it does not show the effect, you also need to set the Gridcontrol property Lookandfeel:style set to Ultraflat, Usedefaultlookandfeel set to False.
11:gridview Set header row and Content row data center
Heading Line 10 describes a textoptions in Headpanel that will Halignment:center
If you are centering the content row data. There are two methods 1: Row by line setting 2: Setting appearences
Appearancecell, Textoptions, Columns, 1:gridview, Run Designer, find Halignment:center.
Halignment:center, Textoptions, viewcaption, appearance, 2:gridview, Run Designer,
12:gridview adds a checkbox and supports multiple selection operations.
Gridview:run Designer, optionsselection, Multiselect:true multiselectmode:checkboxrowselect
13:gridview Adding an ordinal column
Gridview:run Designer, Event-Customdrawrowindicator
adding code to the event:
e.appearance.textoptions.halignment = devexpress.utils.horzalignment.center; if (E.info.isrowindicator) { if (e.rowhandle >= 0) { e.Info.DisplayText = (E. rowhandle + 1). ToString (); } else if (e.rowhandle < 0 && e.rowhandle > -1000) & nbsp; { e. info.appearance.backcolor = system.drawing.color.antiquewhite; e.info.displaytext = "G" + e.rowhandle.tostring (); } }
Also in the Run Desginer, Indicatorwidth set the width of the ordinal column generally around 30 is more suitable for some.
14: Cell Double-click response
Private void gridcontrol1_doubleclick (object sender, eventargs e) { mouseeventargs arg = e as mouseeventargs; if (arg == null) return; gridhitinfo hitinfo = gridview1.calchitinfo (New Point (ARG. X, arg. Y));//Get Coordinate point if (hitinfo.rowhandle >= 0) { DataRow row = Gridview1.getdatarow (Hitinfo.Rowhandle); _ List. Clear (); _list. ADD (Row[0]. ToString ()); Gisresouremoncontrol1.setselectresource (_list); } }
15: Get the value of the selected row
Code:
private void griddata_focusedrowchanged (Object sender, devexpress.xtragrid.views.base.focusedrowchangedeventargs e) { _id = GWEntLib.Utilities.Mix.ConvertUtils.ToInt32 (Griddata.getrowcellvalu (e.focusedrowhandle, "Id")); _emrFileReadList = Emrtemplatefilereadlist.getemrtemplatefilereadlist (_id); gridVersonData.DataSource = _emrFileReadList; }
response event: focusedrowchanged
get field value: Griddata.getrowcellvalue (E.focusedrowhandle, "Id")
Note: Focusedrowchanged is GR Idview event instead of Gridcontrol event
gridcontrol differs from GridView: The former is a container, the latter is a view
16: Fixed GridView list header with no filter effect
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6E/E3/wKiom1WKieHRaU05AAK8iGiTxGI575.jpg "title=" 151709394835451.jpg "alt=" wkiom1wkiehrau05aak8igitxgi575.jpg "/>17, DevExpress GridView Gets the value of the currently selected row.
1 int rowIndex = gridview1.focusedrowhandle;2 DataRow dr = Gridview1.getdatarow (RowIndex); 3 MessageBox.Show ("Courseware \" "+ D R.itemarray[0]. ToString () + "\" "Download succeeded");
18, the GridView removal of the selected line dashed.
Run Desginer-Appearance:FocusRectStyle:none;
This article is from the "Albin" blog, make sure to keep this source http://albin.blog.51cto.com/9047703/1665537
DevExpress, the GridView thing.