private void pShowCtrlProperties() { try { CSReportPaint.cReportPaintObject paintObject = null; cReportControl rptCtrl = null; cReportAspect w_aspect = null; cReportFont w_font = null; cReportImage image = null; bool bMultiSelect = false; String sText = ""; int i = 0; m_showingProperties = true; if (m_fProperties == null) { m_fProperties = new fProperties(); // TODO: set event handler for // ShowEditFormula, ShowHelpChartField, ShowHelpChartGroupField, ShowHelpDbField // UnloadForm } paintObject = m_paint.getPaintObject(m_keyObj); if (paintObject == null) { return; } m_fProperties.txText.Text = paintObject.getText(); rptCtrl = m_report.getControls().item(paintObject.getTag()); if (rptCtrl.getControlType() != csRptControlType.CSRPTCTIMAGE) { m_fProperties.hideTabImage(); } if (rptCtrl.getControlType() != csRptControlType.CSRPTCTCHART) { m_fProperties.hideTabChart(); } else { cUtil.listSetListIndexForId(m_fProperties.cbType, (int)rptCtrl.getChart().getChartType()); cUtil.listSetListIndexForId(m_fProperties.cbFormatType, (int)rptCtrl.getChart().getFormat()); cUtil.listSetListIndexForId(m_fProperties.cbChartSize, (int)rptCtrl.getChart().getDiameter()); cUtil.listSetListIndexForId(m_fProperties.cbChartThickness, (int)rptCtrl.getChart().getThickness()); cUtil.listSetListIndexForId(m_fProperties.cbLinesType, (int)rptCtrl.getChart().getGridLines()); m_fProperties.txChartTop.Text = rptCtrl.getChart().getTop().ToString(); m_fProperties.txDbFieldGroupValue.Text = rptCtrl.getChart().getGroupFieldName(); m_fProperties.setChartGroupIndex(rptCtrl.getChart().getGroupFieldIndex()); m_fProperties.txChartGroupValue.Text = rptCtrl.getChart().getGroupValue(); m_fProperties.chkShowOutlines.Checked = rptCtrl.getChart().getOutlineBars(); m_fProperties.chkShowBarValues.Checked = rptCtrl.getChart().getShowValues(); m_fProperties.chkSort.Checked = rptCtrl.getChart().getSort(); m_fProperties.txText.Text = rptCtrl.getChart().getChartTitle(); if (rptCtrl.getChart().getSeries().count() > 0) { m_fProperties.txDbFieldLbl1.Text = rptCtrl.getChart().getSeries().item(1).getLabelFieldName(); m_fProperties.txDbFieldVal1.Text = rptCtrl.getChart().getSeries().item(1).getValueFieldName(); m_fProperties.setChartIndex(0, rptCtrl.getChart().getSeries().item(1).getLabelIndex()); m_fProperties.setChartIndex(1, rptCtrl.getChart().getSeries().item(1).getValueIndex()); cUtil.listSetListIndexForId(m_fProperties.cbColorSerie1, (int)rptCtrl.getChart().getSeries().item(1).getColor()); if (rptCtrl.getChart().getSeries().count() > 1) { m_fProperties.txDbFieldLbl2.Text = rptCtrl.getChart().getSeries().item(2).getLabelFieldName(); m_fProperties.txDbFieldVal2.Text = rptCtrl.getChart().getSeries().item(2).getValueFieldName(); m_fProperties.setChartIndex(2, rptCtrl.getChart().getSeries().item(2).getLabelIndex()); m_fProperties.setChartIndex(3, rptCtrl.getChart().getSeries().item(2).getValueIndex()); cUtil.listSetListIndexForId(m_fProperties.cbColorSerie2, (int)rptCtrl.getChart().getSeries().item(2).getColor()); } } } if (rptCtrl.getControlType() == csRptControlType.CSRPTCTFIELD || rptCtrl.getControlType() == csRptControlType.CSRPTCTDBIMAGE) { m_fProperties.txText.Enabled = false; cReportField w_field = rptCtrl.getField(); m_fProperties.txText.Text = w_field.getName(); m_fProperties.txDbField.Text = w_field.getName(); m_fProperties.setFieldType(w_field.getFieldType()); m_fProperties.setIndex(w_field.getIndex()); } else { m_fProperties.hideTabField(); m_fProperties.txText.Enabled = true; } m_fProperties.txName.Text = rptCtrl.getName(); m_fProperties.lbControl.Text = rptCtrl.getName(); m_fProperties.chkFormulaHide.Checked = rptCtrl.getHasFormulaHide(); m_fProperties.chkFormulaValue.Checked = rptCtrl.getHasFormulaValue(); m_fProperties.txExportColIdx.Text = rptCtrl.getExportColIdx().ToString(); m_fProperties.chkIsFreeCtrl.Checked = rptCtrl.getIsFreeCtrl(); m_fProperties.txTag.Text = rptCtrl.getTag(); m_fProperties.setFormulaHide(rptCtrl.getFormulaHide().getText()); m_fProperties.setFormulaValue(rptCtrl.getFormulaValue().getText()); m_fProperties.txIdxGroup.Text = rptCtrl.getFormulaValue().getIdxGroup().ToString(); m_fProperties.opBeforePrint.Checked = rptCtrl.getFormulaValue().getWhenEval() == csRptWhenEval.CSRPTEVALPRE; m_fProperties.opAfterPrint.Checked = rptCtrl.getFormulaValue().getWhenEval() == csRptWhenEval.CSRPTEVALPOST; w_aspect = rptCtrl.getLabel().getAspect(); m_fProperties.chkCanGrow.Checked = w_aspect.getCanGrow(); m_fProperties.txFormat.Text = w_aspect.getFormat(); m_fProperties.txSymbol.Text = w_aspect.getSymbol(); m_fProperties.setIsAccounting(w_aspect.getIsAccounting()); m_fProperties.chkWordWrap.Checked = w_aspect.getWordWrap(); cUtil.listSetListIndexForId(m_fProperties.cbAlign, (int)w_aspect.getAlign()); m_fProperties.txBorderColor.Text = w_aspect.getBorderColor().ToString(); m_fProperties.txBorder3D.Text = w_aspect.getBorderColor3d().ToString(); m_fProperties.txBorderShadow.Text = w_aspect.getBorderColor3dShadow().ToString(); m_fProperties.chkBorderRounded.Checked = w_aspect.getBorderRounded(); m_fProperties.txBorderWidth.Text = w_aspect.getBorderWidth().ToString(); cUtil.listSetListIndexForId(m_fProperties.cbBorderType, (int)w_aspect.getBorderType()); w_font = w_aspect.getFont(); m_fProperties.txFont.Text = w_font.getName(); m_fProperties.txForeColor.Text = w_font.getForeColor().ToString(); m_fProperties.txFontSize.Text = w_font.getSize().ToString(); m_fProperties.chkFontBold.Checked = w_font.getBold(); m_fProperties.chkFontItalic.Checked = w_font.getItalic(); m_fProperties.chkFontUnderline.Checked = w_font.getUnderline(); m_fProperties.chkFontStrike.Checked = w_font.getStrike(); w_aspect = paintObject.getAspect(); m_fProperties.txLeft.Text = w_aspect.getLeft().ToString(); m_fProperties.txTop.Text = w_aspect.getTop().ToString(); m_fProperties.txWidth.Text = w_aspect.getWidth().ToString(); m_fProperties.txHeight.Text = w_aspect.getHeight().ToString(); m_fProperties.txBackColor.Text = w_aspect.getBackColor().ToString(); m_fProperties.chkTransparent.Checked = w_aspect.getTransparent(); bMultiSelect = m_vSelectedKeys.Length > 1; m_fProperties.resetChangedFlags(); m_fProperties.ShowDialog(); if (!m_fProperties.getOk()) { return; } for (i = 1; i <= m_vSelectedKeys.Length; i++) { paintObject = m_paint.getPaintObject(m_vSelectedKeys[i]); rptCtrl = m_report.getControls().item(paintObject.getTag()); if (!bMultiSelect) { if (rptCtrl.getName() != m_fProperties.txName.Text) { if (rptCtrl.getName() != "") { if (cWindow.ask("You have changed the name of this control.;;Do you want to update all references to this control in all formulas of this report?", VbMsgBoxResult.vbYes)) { pUpdateFormulas(rptCtrl.getName(), m_fProperties.txName.Text); } } } rptCtrl.setName(m_fProperties.txName.Text); } if (m_fProperties.getTextChanged()) { rptCtrl.getLabel().setText(m_fProperties.txText.Text); } if (m_fProperties.getTagChanged()) { rptCtrl.setTag(m_fProperties.txTag.Text); } if (m_fProperties.getSetFormulaHideChanged()) { rptCtrl.setHasFormulaHide(m_fProperties.chkFormulaHide.Checked); } if (m_fProperties.getSetFormulaValueChanged()) { rptCtrl.setHasFormulaValue(m_fProperties.chkFormulaValue.Checked); } if (m_fProperties.getFormulaHideChanged()) { rptCtrl.getFormulaHide().setText(m_fProperties.getFormulaHide()); } if (m_fProperties.getFormulaValueChanged()) { rptCtrl.getFormulaValue().setText(m_fProperties.getFormulaValue()); } if (m_fProperties.getIdxGroupChanged()) { rptCtrl.getFormulaValue().setIdxGroup((int)cReportGlobals.val(m_fProperties.txIdxGroup.Text)); } if (m_fProperties.getWhenEvalChanged()) { rptCtrl.getFormulaValue().setWhenEval(m_fProperties.opAfterPrint.Checked ? csRptWhenEval.CSRPTEVALPOST : csRptWhenEval.CSRPTEVALPRE); } if (m_fProperties.getExportColIdxChanged()) { rptCtrl.setExportColIdx((int)cReportGlobals.val(m_fProperties.txExportColIdx.Text)); } if (m_fProperties.getIsFreeCtrlChanged()) { rptCtrl.setIsFreeCtrl(m_fProperties.chkIsFreeCtrl.Checked); } if (rptCtrl.getControlType() == csRptControlType.CSRPTCTFIELD || rptCtrl.getControlType() == csRptControlType.CSRPTCTDBIMAGE) { cReportField w_field = rptCtrl.getField(); if (m_fProperties.getDbFieldChanged()) { w_field.setFieldType(m_fProperties.getFieldType()); w_field.setIndex(m_fProperties.getIndex()); w_field.setName(m_fProperties.txDbField.Text); } } if (m_fProperties.getPictureChanged()) { image = rptCtrl.getImage(); PictureBox picImage = m_fProperties.picImage; image.setImage((Image)picImage.Image.Clone()); } if (rptCtrl.getControlType() == csRptControlType.CSRPTCTCHART) { if (rptCtrl.getChart().getSeries().count() < 1) { rptCtrl.getChart().getSeries().add(); } if (m_fProperties.getChartTypeChanged()) { rptCtrl.getChart().setChartType((csRptChartType)cUtil.listID(m_fProperties.cbType)); } if (m_fProperties.getChartFormatTypeChanged()) { rptCtrl.getChart().setFormat((csRptChartFormat)cUtil.listID(m_fProperties.cbFormatType)); } if (m_fProperties.getChartSizeChanged()) { rptCtrl.getChart().setDiameter((csRptChartPieDiameter)cUtil.listID(m_fProperties.cbChartSize)); } if (m_fProperties.getChartThicknessChanged()) { rptCtrl.getChart().setThickness((csRptChartPieThickness)cUtil.listID(m_fProperties.cbChartThickness)); } if (m_fProperties.getChartLinesTypeChanged()) { rptCtrl.getChart().setGridLines((csRptChartLineStyle)cUtil.listID(m_fProperties.cbLinesType)); } if (m_fProperties.getChartShowLinesChanged()) { rptCtrl.getChart().setOutlineBars(m_fProperties.chkShowOutlines.Checked); } if (m_fProperties.getChartShowValuesChanged()) { rptCtrl.getChart().setShowValues(m_fProperties.chkShowBarValues.Checked); } if (m_fProperties.getTextChanged()) { rptCtrl.getChart().setChartTitle(m_fProperties.txText.Text); } if (m_fProperties.getChartTopChanged()) { rptCtrl.getChart().setTop((int)cReportGlobals.val(m_fProperties.txChartTop.Text)); } if (m_fProperties.getChartSortChanged()) { rptCtrl.getChart().setSort(m_fProperties.chkSort.Checked); } if (m_fProperties.getChartGroupValueChanged()) { rptCtrl.getChart().setGroupValue(m_fProperties.txChartGroupValue.Text); } if (m_fProperties.getChartFieldGroupChanged()) { rptCtrl.getChart().setGroupFieldName(m_fProperties.txDbFieldGroupValue.Text); rptCtrl.getChart().setGroupFieldIndex(m_fProperties.getChartGroupIndex()); } if (m_fProperties.getChartFieldLbl1Changed()) { rptCtrl.getChart().getSeries().item(1).setLabelFieldName(m_fProperties.txDbFieldLbl1.Text); rptCtrl.getChart().getSeries().item(1).setLabelIndex(m_fProperties.getChartIndex(0)); } if (m_fProperties.getChartFieldVal1Changed()) { rptCtrl.getChart().getSeries().item(1).setValueFieldName(m_fProperties.txDbFieldVal1.Text); rptCtrl.getChart().getSeries().item(1).setValueIndex(m_fProperties.getChartIndex(1)); } if (m_fProperties.getChartColorSerie1Changed()) { rptCtrl.getChart().getSeries().item(1).setColor((csColors)cUtil.listID(m_fProperties.cbColorSerie1)); } if (m_fProperties.getChartFieldLbl2Changed() || m_fProperties.getChartFieldVal2Changed()) { if (rptCtrl.getChart().getSeries().count() < 2) { rptCtrl.getChart().getSeries().add(); } } if (m_fProperties.txDbFieldLbl2.Text == "" || m_fProperties.txDbFieldVal2.Text == "") { if (rptCtrl.getChart().getSeries().count() > 1) { rptCtrl.getChart().getSeries().remove(2); } } if (rptCtrl.getChart().getSeries().count() > 1) { if (m_fProperties.getChartFieldLbl2Changed()) { rptCtrl.getChart().getSeries().item(2).setLabelFieldName(m_fProperties.txDbFieldLbl2.Text); rptCtrl.getChart().getSeries().item(2).setLabelIndex(m_fProperties.getChartIndex(2)); } if (m_fProperties.getChartFieldVal2Changed()) { rptCtrl.getChart().getSeries().item(2).setValueFieldName(m_fProperties.txDbFieldVal2.Text); rptCtrl.getChart().getSeries().item(2).setValueIndex(m_fProperties.getChartIndex(3)); } if (m_fProperties.getChartColorSerie2Changed()) { rptCtrl.getChart().getSeries().item(2).setColor((csColors)cUtil.listID(m_fProperties.cbColorSerie2)); } } } if (m_fProperties.getTextChanged()) { paintObject.setText(m_fProperties.txText.Text); } w_aspect = rptCtrl.getLabel().getAspect(); if (m_fProperties.getLeftChanged()) { w_aspect.setLeft((float)cReportGlobals.val(m_fProperties.txLeft.Text)); } if (m_fProperties.getTopChanged()) { w_aspect.setTop((float)cReportGlobals.val(m_fProperties.txTop.Text)); } if (m_fProperties.getWidthChanged()) { w_aspect.setWidth((float)cReportGlobals.val(m_fProperties.txWidth.Text)); } if (m_fProperties.getHeightChanged()) { w_aspect.setHeight((float)cReportGlobals.val(m_fProperties.txHeight.Text)); } if (m_fProperties.getBackColorChanged()) { w_aspect.setBackColor((int)cReportGlobals.val(m_fProperties.txBackColor.Text)); } if (m_fProperties.getTransparentChanged()) { w_aspect.setTransparent(m_fProperties.chkTransparent.Checked); } if (m_fProperties.getAlignChanged()) { w_aspect.setAlign((CSReportGlobals.HorizontalAlignment)cUtil.listID(m_fProperties.cbAlign)); } if (m_fProperties.getFormatChanged()) { w_aspect.setFormat(m_fProperties.txFormat.Text); } if (m_fProperties.getSymbolChanged()) { w_aspect.setSymbol(m_fProperties.txSymbol.Text); w_aspect.setIsAccounting(m_fProperties.getIsAccounting()); } if (m_fProperties.getWordWrapChanged()) { w_aspect.setWordWrap(m_fProperties.chkWordWrap.Checked); } if (m_fProperties.getCanGrowChanged()) { w_aspect.setCanGrow(m_fProperties.chkCanGrow.Checked); } if (m_fProperties.getBorderColorChanged()) { w_aspect.setBorderColor((int)cReportGlobals.val(m_fProperties.txBorderColor.Text)); } if (m_fProperties.getBorder3DChanged()) { w_aspect.setBorderColor3d((int)cReportGlobals.val(m_fProperties.txBorder3D.Text)); } if (m_fProperties.getBorder3DShadowChanged()) { w_aspect.setBorderColor3dShadow((int)cReportGlobals.val(m_fProperties.txBorderShadow.Text)); } if (m_fProperties.getBorderRoundedChanged()) { w_aspect.setBorderRounded(m_fProperties.chkBorderRounded.Checked); } if (m_fProperties.getBorderWidthChanged()) { w_aspect.setBorderWidth((int)cReportGlobals.val(m_fProperties.txBorderWidth.Text)); } if (m_fProperties.getBorderTypeChanged()) { w_aspect.setBorderType((csReportBorderType)cUtil.listID(m_fProperties.cbBorderType)); } w_font = w_aspect.getFont(); if (m_fProperties.getFontChanged()) { w_font.setName(m_fProperties.txFont.Text); } if (m_fProperties.getForeColorChanged()) { w_font.setForeColor((int)cReportGlobals.val(m_fProperties.txForeColor.Text)); } if (m_fProperties.getFontSizeChanged()) { w_font.setSize((float)cReportGlobals.val(m_fProperties.txFontSize.Text)); } if (m_fProperties.getBoldChanged()) { w_font.setBold(m_fProperties.chkFontBold.Checked); } if (m_fProperties.getItalicChanged()) { w_font.setItalic(m_fProperties.chkFontItalic.Checked); } if (m_fProperties.getUnderlineChanged()) { w_font.setUnderline(m_fProperties.chkFontUnderline.Checked); } if (m_fProperties.getStrikeChanged()) { w_font.setStrike(m_fProperties.chkFontStrike.Checked); } if (m_fProperties.getPictureChanged()) { paintObject.setImage(rptCtrl.getImage().getImage()); } // // TODO: check if we can refactor this now we have a better class hierarchy // w_aspect = paintObject.getAspect(); if (m_fProperties.getLeftChanged()) { w_aspect.setLeft((float)cReportGlobals.val(m_fProperties.txLeft.Text)); } if (m_fProperties.getTopChanged()) { w_aspect.setTop((float)cReportGlobals.val(m_fProperties.txTop.Text)); } if (m_fProperties.getWidthChanged()) { w_aspect.setWidth((float)cReportGlobals.val(m_fProperties.txWidth.Text)); } if (m_fProperties.getHeightChanged()) { w_aspect.setHeight((float)cReportGlobals.val(m_fProperties.txHeight.Text)); } if (m_fProperties.getBackColorChanged()) { w_aspect.setBackColor((int)cReportGlobals.val(m_fProperties.txBackColor.Text)); } if (m_fProperties.getTransparentChanged()) { w_aspect.setTransparent(m_fProperties.chkTransparent.Checked); } if (m_fProperties.getAlignChanged()) { w_aspect.setAlign((CSReportGlobals.HorizontalAlignment)cUtil.listID(m_fProperties.cbAlign)); } if (m_fProperties.getFormatChanged()) { w_aspect.setFormat(m_fProperties.txFormat.Text); } if (m_fProperties.getSymbolChanged()) { w_aspect.setSymbol(m_fProperties.txSymbol.Text); } if (m_fProperties.getWordWrapChanged()) { w_aspect.setWordWrap(m_fProperties.chkWordWrap.Checked); } if (m_fProperties.getBorderTypeChanged()) { w_aspect.setBorderType((csReportBorderType)cUtil.listID(m_fProperties.cbBorderType)); } if (w_aspect.getBorderType() == csReportBorderType.CSRPTBSNONE) { w_aspect.setBorderColor(Color.Black.ToArgb()); w_aspect.setBorderWidth(1); w_aspect.setBorderRounded(false); w_aspect.setBorderType(csReportBorderType.CSRPTBSFIXED); } else { if (m_fProperties.getBorderColorChanged()) { w_aspect.setBorderColor((int)cReportGlobals.val(m_fProperties.txBorderColor.Text)); } if (m_fProperties.getBorder3DChanged()) { w_aspect.setBorderColor3d((int)cReportGlobals.val(m_fProperties.txBorder3D.Text)); } if (m_fProperties.getBorder3DShadowChanged()) { w_aspect.setBorderColor3dShadow((int)cReportGlobals.val(m_fProperties.txBorderShadow.Text)); } if (m_fProperties.getBorderRoundedChanged()) { w_aspect.setBorderRounded(m_fProperties.chkBorderRounded.Checked); } if (m_fProperties.getBorderWidthChanged()) { w_aspect.setBorderWidth((int)cReportGlobals.val(m_fProperties.txBorderWidth.Text)); } } w_font = w_aspect.getFont(); if (m_fProperties.getFontChanged()) { w_font.setName(m_fProperties.txFont.Text); } if (m_fProperties.getForeColorChanged()) { w_font.setForeColor((int)cReportGlobals.val(m_fProperties.txForeColor.Text)); } if (m_fProperties.getFontSizeChanged()) { w_font.setSize((float)cReportGlobals.val(m_fProperties.txFontSize.Text)); } if (m_fProperties.getBoldChanged()) { w_font.setBold(m_fProperties.chkFontBold.Checked); } if (m_fProperties.getItalicChanged()) { w_font.setItalic(m_fProperties.chkFontItalic.Checked); } if (m_fProperties.getUnderlineChanged()) { w_font.setUnderline(m_fProperties.chkFontUnderline.Checked); } if (m_fProperties.getStrikeChanged()) { w_font.setStrike(m_fProperties.chkFontStrike.Checked); } } m_dataHasChanged = true; } catch (Exception ex) { cError.mngError(ex, "pShowCtrlProperties", C_MODULE, ""); } finally { m_fProperties.Hide(); m_showingProperties = false; m_fProperties = null; m_paint.endMove(m_picReport.CreateGraphics()); } }
private void m_fProperties_UnloadForm() { m_fProperties = null; }
public void destroyPropertiesFormReference() { m_fProperties = null; }