public setControlType ( csRptControlType rhs ) : void | ||
rhs | csRptControlType | |
Résultat | void |
private void pSetNewControlProperties(cReportControl ctrl) { cReportAspect aspect = null; ctrl.getLabel().getAspect().setAlign(CSReportGlobals.HorizontalAlignment.Left); switch (m_controlType) { case csRptEditCtrlType.CSRPTEDITFIELD: ctrl.setControlType(csRptControlType.CSRPTCTFIELD); ctrl.getLabel().setText(m_fieldName); cReportField field = ctrl.getField(); field.setIndex(m_fieldIndex); field.setName(m_fieldName); field.setFieldType(m_fieldType); if (cGlobals.isNumberField(m_fieldType)) { aspect = ctrl.getLabel().getAspect(); aspect.setAlign(CSReportGlobals.HorizontalAlignment.Right); aspect.setFormat("#0.00;-#0.00"); } break; case csRptEditCtrlType.CSRPTEDITFORMULA: ctrl.setControlType(csRptControlType.CSRPTCTLABEL); ctrl.getFormulaValue().setText(m_formulaText + "(" + m_controlName + ")"); ctrl.setHasFormulaValue(true); ctrl.getLabel().getAspect().setFormat("0.00;-0.00"); ctrl.getLabel().getAspect().getFont().setBold(true); ctrl.getLabel().setText(ctrl.getFormulaValue().getText()); ctrl.getLabel().getAspect().setAlign(CSReportGlobals.HorizontalAlignment.Right); break; case csRptEditCtrlType.CSRPTEDITLABEL: ctrl.setControlType(csRptControlType.CSRPTCTLABEL); ctrl.getLabel().setText(m_fieldName); ctrl.getLabel().getAspect().getFont().setBold(true); break; case csRptEditCtrlType.CSRPTEDITIMAGE: ctrl.setControlType(csRptControlType.CSRPTCTIMAGE); ctrl.getLabel().setText(m_fieldName); break; case csRptEditCtrlType.CSRPTEDITCHART: ctrl.setControlType(csRptControlType.CSRPTCTCHART); ctrl.getLabel().setText(m_fieldName); break; } const int ctrl_height = 285; const int ctrl_width = 2000; aspect = ctrl.getLabel().getAspect(); aspect.setWidth(ctrl_width); aspect.setHeight(ctrl_height); aspect.setTransparent(true); }
private void pSetNewControlProperties(cReportControl ctrl) { const int CTRL_HEIGHT = 19; const int CTRL_WIDTH = 133; const int LINE_HEIGHT = 1; cReportLabel label = null; cReportAspect aspect = null; int ctrlHeigth = CTRL_HEIGHT; bool transparent = true; ctrl.getLabel().getAspect().setAlign(CSReportGlobals.HorizontalAlignment.Left); switch (m_controlType) { case csRptEditCtrlType.field: ctrl.setControlType(csRptControlType.CSRPTCTFIELD); ctrl.getLabel().setText(m_fieldName); cReportField field = ctrl.getField(); field.setIndex(m_fieldIndex); field.setName(m_fieldName); field.setFieldType(m_fieldType); if (cDatabaseGlobals.isNumberField(m_fieldType)) { aspect = ctrl.getLabel().getAspect(); aspect.setAlign(CSReportGlobals.HorizontalAlignment.Right); aspect.setFormat("#0.00;-#0.00"); } break; case csRptEditCtrlType.formula: ctrl.setControlType(csRptControlType.CSRPTCTLABEL); ctrl.getFormulaValue().setText(m_formulaText + "(" + m_controlName + ")"); ctrl.setHasFormulaValue(true); label = ctrl.getLabel(); aspect = label.getAspect(); aspect.setFormat("0.00;-0.00"); aspect.getFont().setBold(true); label.setText(ctrl.getFormulaValue().getText()); aspect.setAlign(CSReportGlobals.HorizontalAlignment.Right); break; case csRptEditCtrlType.label: ctrl.setControlType(csRptControlType.CSRPTCTLABEL); label = ctrl.getLabel(); label.setText(m_fieldName); label.getAspect().getFont().setBold(true); break; case csRptEditCtrlType.lineLabel: ctrlHeigth = LINE_HEIGHT; ctrl.setControlType(csRptControlType.CSRPTCTLABEL); label = ctrl.getLabel(); label.setText(m_fieldName); aspect = label.getAspect(); aspect.getFont().setBold(true); aspect.setBackColor(Color.Gray.ToArgb()); transparent = false; break; case csRptEditCtrlType.image: ctrl.setControlType(csRptControlType.CSRPTCTIMAGE); ctrl.getLabel().setText(m_fieldName); break; case csRptEditCtrlType.chart: ctrl.setControlType(csRptControlType.CSRPTCTCHART); ctrl.getLabel().setText(m_fieldName); break; } aspect = ctrl.getLabel().getAspect(); aspect.setWidth(CTRL_WIDTH); aspect.setHeight(ctrlHeigth); aspect.setTransparent(transparent); }
private void pCopyControl(cReportControl fromCtrl, cReportControl toCtrl) { toCtrl.setControlType(fromCtrl.getControlType()); cReportField field = toCtrl.getField(); field.setFieldType(fromCtrl.getField().getFieldType()); field.setIndex(fromCtrl.getField().getIndex()); field.setName(fromCtrl.getField().getName()); toCtrl.getFormulaHide().setName(fromCtrl.getFormulaHide().getName()); toCtrl.getFormulaHide().setText(fromCtrl.getFormulaHide().getText()); toCtrl.getFormulaValue().setName(fromCtrl.getFormulaValue().getName()); toCtrl.getFormulaValue().setText(fromCtrl.getFormulaValue().getText()); toCtrl.setHasFormulaHide(fromCtrl.getHasFormulaHide()); toCtrl.setHasFormulaValue(fromCtrl.getHasFormulaValue()); pCopyAspect(fromCtrl.getImage().getAspect(), toCtrl.getImage().getAspect()); cReportLabel label = toCtrl.getLabel(); pCopyAspect(fromCtrl.getLabel().getAspect(), label.getAspect()); label.setCanGrow(fromCtrl.getLabel().getCanGrow()); label.setText(fromCtrl.getLabel().getText()); pCopyAspect(fromCtrl.getLine().getAspect(), toCtrl.getLine().getAspect()); pCopyChart(fromCtrl.getChart(), toCtrl.getChart()); }
private bool pInitCtrls(cReportControl ctrl, out int idx, List<object[]> recordsets, String fieldName) { bool found = false; int j = 0; bool bIsDBImage = false; string dataSource = pGetDataSource(fieldName); // index of the group which contains the control // int k = 0; for (int _i = 0; _i < recordsets.Count; _i++) { object[] varRs = recordsets[_i]; String rsDataSource = (String)varRs[1]; if (rsDataSource.ToUpper() == dataSource.ToUpper() || dataSource == "") { DataTable rs = (DataTable)varRs[0]; for (j = 0; j < rs.Columns.Count; j++) { if (rs.Columns[j].ColumnName.ToUpper() == cReportGlobals.getRealName(fieldName).ToUpper()) { // TODO: we need to check what is the value of rs.Columns[j].DataType // when the column contains a binary field (tipicaly used for images) // System.TypeCode typeCode = System.Type.GetTypeCode(rs.Columns[j].DataType); bIsDBImage = typeCode == System.TypeCode.Object; found = true; break; } } } if (found) { break; } k = k + 1000; } if (found) { idx = j + k; if (bIsDBImage) { ctrl.setControlType(csRptControlType.CSRPTCTDBIMAGE); } } else { throw new ReportException(csRptErrors.FIELD_NOT_FOUND, C_MODULE, cReportError.errGetDescript(csRptErrors.FIELD_NOT_FOUND, ctrl.getName(), fieldName) ); } return true; }