当用到DevExpress中的DevExpress.XtraGrid.Columns.GridColumn列时,会根据数据来设置其属性。
代码如下:
DDataGridView dataGridView; DevExpress.XtraGrid.Columns.GridColumn colSensorName = new DevExpress.XtraGrid.Columns.GridColumn(); colSensorName.Caption = "测点名称"; colSensorName.FieldName = "SensorName"; colSensorName.VisibleIndex = 2; colSensorName.Width = 100;// colSensor_ID.OptionsColumn.FixedWidth = true; colSensorName.OptionsColumn.AllowEdit = false;//设置只读 dataGridView.Columns.Add(colSensorName);
在编程的过程中,只有不断的尝试才能达到最佳的效果,这就是开发……