Copy codeThe Code is as follows: this. dgTankView. Columns ["ID"]. DataPropertyName = "ID ";
This. dgTankView. Columns ["TankName"]. DataPropertyName = "Name ";
This. dgTankView. Columns ["Area"]. DataPropertyName = "Area ";
This. dgTankView. Columns ["Type"]. DataPropertyName = "Type ";
This. dgTankView. Columns ["Status"]. DataPropertyName = "Status ";
This. dgTankView. Columns ["Material"]. DataPropertyName = "Material ";
This. dgTankView. Columns ["MaterialCategory"]. DataPropertyName = "MaterialCategory ";
This. dgTankView. Columns ["MaxLevel"]. DataPropertyName = "MaxLevel ";
This. dgTankView. Columns ["MinLevel"]. DataPropertyName = "MinLevel ";
This. dgTankView. Columns ["MaxCapacity"]. DataPropertyName = "MaxCapacity ";
This. dgTankView. Columns ["MinCapacity"]. DataPropertyName = "MinCapacity ";
This. dgTankView. Columns ["Code"]. DataPropertyName = "Code ";
//// Set columns width
// This. dgTankView. Columns ["MaterialCategory"]. Width = 80;
// This. dgTankView. Columns ["Material"]. Width = 240;
// This. dgTankView. Columns ["TankName"]. Width = 100;
// This. dgTankView. Columns ["Area"]. Width = 80;
// This. dgTankView. Columns ["MaxLevel"]. Width = 100;
// This. dgTankView. Columns ["MinLevel"]. Width = 100;
// This. dgTankView. Columns ["MaxCapacity"]. Width = 100;
// This. dgTankView. Columns ["MinCapacity"]. Width = 100;
// This. dgTankView. Columns ["Type"]. Width = 60;
// This. dgTankView. Columns ["Status"]. AutoSizeMode = maid. Fill;
This. dgTankView. AutoGenerateColumns = false;
This. dgTankView. DataSource = tankviews;
Int rowCount = dgTankView. RowCount;
If (SelectedIndex <rowCount | SelectedIndex> = rowCount)
{
This. dgTankView. Rows [0]. Selected = true;
}
Else
{
This. dgTankView. Rows [this. SelectedIndex]. Selected = true;
}
For (int I = 0; I <dgrdSelectedMaterial. RowCount; I ++)
{
If (decimal. parse (dgrdSelectedMaterial. rows [I]. cells ["ColumnSelectedMinRatio"]. value. toString ()> decimal. parse (dgrdSelectedMaterial. rows [I]. cells ["ColumnSelectedMaxRatio"]. value. toString ()))
{
MessageUtil. info (string. format (Config. messageManager [MessageGroupHelper. formatToName (int) MessageGroup. client), "1959"]. toString (), dgrdSelectedMaterial. rows [I]. cells ["ColumnSelectedName"]. value. toString ()));
Return false;
}
}
RowHeardersVisible = false
Selection Mode = Full row Select
ColumnHeaderDefault = alignCenter
/// High
DgrdStaticTank. ColumnHeadersHeight = 40;
DgrdBlendMaterialQuality. ColumnHeadersHeightSizeMode = maid. AutoSize;
Width:
DgrdBlendMaterial. AutoGenerateColumns = false;
DgrdBlendMaterial. AutoSizeColumnsMode = maid. Fill;
DgrdBlendMaterial. Columns ["ColumnMaterialTankName"]. Width = 80;
----------------------------------------------------------
This. Maid. Value; // The Value of the currently active cell
This. dataGridView1.CurrentCell. RowIndex; // row of the currently active cell
This. Maid. ColumnIndex; // column of the currently active cell
This. Maid [5]. Cells [3]. Value; // The Value of the cell in column 6th of row 4th
DataGridView [col, row]. Value = obj;
ControlUtil. SetDataGridViewStyleForMasterData (dgrdBlendMaterial );
DgrdBlendMaterial. AutoGenerateColumns = false;
DgrdBlendMaterial. AutoSizeColumnsMode = maid. Fill;
DgrdBlendMaterial. Columns [& quot; ColumnMaterialName & quot;]. Width = 200;
UcPagingTank. DataBindings. Add ("PageIndex", tankListModel, "PageIndex", true, performanceupdatemode. Never );
----- Display format of a column ----
DgrdTank. Columns ["ColumnTimeStamp"]. DefaultCellStyle. Format = Config. AppConfig. DateTimeFormat;
--- Obtain the value of the selected column -----
StrCurRoleID = dgrdRoleList. SelectedRows [0]. Cells [0]. FormattedValue. ToString ();