/// <summary> /// 加载质量特性GridView /// </summary> /// <param name="rows"></param> private void loadDataTable(DataGridViewRowCollection rows) { rows.Clear(); foreach (PartProperties pro in this.partProperties) { int i = rows.Add(); rows[i].Cells["partID"].Value = pro.id; rows[i].Cells["partName"].Value = pro.name; rows[i].Cells["parentID"].Value = pro.parentID; rows[i].Cells["partDensity"].Value = pro.density.ToString("e"); rows[i].Cells["partDimension"].Value = pro.dimension.ToString("e"); rows[i].Cells["partArea"].Value = pro.area.ToString("e"); rows[i].Cells["partQuality"].Value = pro.quality.ToString("e"); rows[i].Cells["partCenterOfGravityX"].Value = pro.centerOfGravityX.ToString("e");// String.Join(",", pro.centerOfGravity); rows[i].Cells["partCenterOfGravityY"].Value = pro.centerOfGravityY.ToString("e"); rows[i].Cells["partCenterOfGravityZ"].Value = pro.centerOfGravityZ.ToString("e"); rows[i].Cells["partInertiaMatrixIXX"].Value = pro.inertiaMatrixIXX.ToString("e"); rows[i].Cells["partInertiaMatrixIXY"].Value = pro.inertiaMatrixIXY.ToString("e"); rows[i].Cells["partInertiaMatrixIXZ"].Value = pro.inertiaMatrixIXZ.ToString("e"); rows[i].Cells["partInertiaMatrixIYX"].Value = pro.inertiaMatrixIYX.ToString("e"); rows[i].Cells["partInertiaMatrixIYY"].Value = pro.inertiaMatrixIYY.ToString("e"); rows[i].Cells["partInertiaMatrixIYZ"].Value = pro.inertiaMatrixIYZ.ToString("e"); rows[i].Cells["partInertiaMatrixIZX"].Value = pro.inertiaMatrixIZX.ToString("e"); rows[i].Cells["partInertiaMatrixIZY"].Value = pro.inertiaMatrixIZY.ToString("e"); rows[i].Cells["partInertiaMatrixIZZ"].Value = pro.inertiaMatrixIZZ.ToString("e"); } }
/// <summary> /// 加载Excel数据表格GridView /// </summary> /// <param name="rows"></param> private void loadExcelDataTable(DataGridViewRowCollection rows,PartProperties[] pros) { rows.Clear(); foreach (PartProperties pro in pros) { int i = rows.Add(); rows[i].Cells["partID_excel"].Value = pro.id; rows[i].Cells["partName_excel"].Value = pro.name; rows[i].Cells["parentID_excel"].Value = pro.parentID; rows[i].Cells["partDensity_excel"].Value = pro.density.ToString("e"); rows[i].Cells["partDimension_excel"].Value = pro.dimension.ToString("e"); rows[i].Cells["partArea_excel"].Value = pro.area.ToString("e"); rows[i].Cells["partQuality_excel"].Value = pro.quality.ToString("e"); rows[i].Cells["partPercent_excel"].Value = pro.qualityPercent; rows[i].Cells["partCenterOfGravityX_excel"].Value = pro.centerOfGravityX.ToString("e");//String.Join(",", pro.centerOfGravity); rows[i].Cells["partCenterOfGravityY_excel"].Value = pro.centerOfGravityY.ToString("e"); rows[i].Cells["partCenterOfGravityZ_excel"].Value = pro.centerOfGravityZ.ToString("e"); rows[i].Cells["partInertiaMatrixIXX_excel"].Value = pro.inertiaMatrixIXX.ToString("e"); rows[i].Cells["partInertiaMatrixIXY_excel"].Value = pro.inertiaMatrixIXY.ToString("e"); rows[i].Cells["partInertiaMatrixIXZ_excel"].Value = pro.inertiaMatrixIXZ.ToString("e"); rows[i].Cells["partInertiaMatrixIYY_excel"].Value = pro.inertiaMatrixIYY.ToString("e"); rows[i].Cells["partInertiaMatrixIYX_excel"].Value = pro.inertiaMatrixIYX.ToString("e"); rows[i].Cells["partInertiaMatrixIYZ_excel"].Value = pro.inertiaMatrixIYZ.ToString("e"); rows[i].Cells["partInertiaMatrixIZX_excel"].Value = pro.inertiaMatrixIZX.ToString("e"); rows[i].Cells["partInertiaMatrixIZY_excel"].Value = pro.inertiaMatrixIZY.ToString("e"); rows[i].Cells["partInertiaMatrixIZZ_excel"].Value = pro.inertiaMatrixIZZ.ToString("e"); } }