private void m_picReport_KeyDown(int keyCode, int shift) { cReportAspect aspect = null; try { // only process arrow keys switch (keyCode) { case (int)Keys.Up: break; case (int)Keys.Down: break; case (int)Keys.Left: break; case (int)Keys.Right: break; default: return; } float x = 0; float y = 0; if (m_vSelectedKeys.Length < 1) { return; } if (!m_keyboardMove) { aspect = m_paint.getPaintObject(m_vSelectedKeys[1]).getAspect(); y = aspect.getTop(); x = aspect.getLeft(); } else { y = m_y; x = m_x; } // resize // if (Control.ModifierKeys == Keys.Shift) { if (m_keySizing == "") { m_keySizing = m_paint.getPaintObject(m_vSelectedKeys[1]).getKey(); } if (!m_keyboardMove) { aspect = m_paint.getPaintObject(m_vSelectedKeys[1]).getAspect(); y = y + aspect.getHeight(); x = x + aspect.getWidth(); pSetMovingFromKeyboard(x, y); if (m_keySizing == "") { m_keySizing = m_paint.getPaintObject(m_vSelectedKeys[1]).getKey(); } switch (keyCode) { case (int)Keys.Down: case (int)Keys.Up: m_keyMoving = ""; m_moveType = csRptEditorMoveType.CSRPTEDMOVDOWN; break; case (int)Keys.Right: case (int)Keys.Left: m_keyMoving = ""; m_moveType = csRptEditorMoveType.CSRPTEDMOVRIGHT; break; } } switch (keyCode) { case (int)Keys.Up: y = y - m_keyboardMoveStep; break; case (int)Keys.Down: y = y + m_keyboardMoveStep; break; case (int)Keys.Left: x = x - m_keyboardMoveStep; break; case (int)Keys.Right: x = x + m_keyboardMoveStep; break; } // move // } else { if (!m_keyboardMove) { pSetMovingFromKeyboard(x, y); } if (m_keyMoving == "") { m_keyMoving = m_paint.getPaintObject(m_vSelectedKeys[1]).getKey(); } switch (keyCode) { case (int)Keys.Up: y = y - m_keyboardMoveStep; break; case (int)Keys.Down: y = y + m_keyboardMoveStep; break; case (int)Keys.Left: x = x - m_keyboardMoveStep; break; case (int)Keys.Right: x = x + m_keyboardMoveStep; break; } } m_picReport_MouseMove(MouseButtons.Left, 0, x, y); m_x = x; m_y = y; m_keyboardMove = true; } catch (Exception ex) { cError.mngError(ex, "m_picReport_KeyDown", C_MODULE, ""); } }
private void reLoadReport() { cReportPaintObject paintSec = null; m_paint = null; m_keyMoving = ""; m_keySizing = ""; m_keyObj = ""; m_keyFocus = ""; m_moveType = csRptEditorMoveType.CSRPTEDMOVTNONE; m_paint = new CSReportPaint.cReportPaint(); cReportPaperInfo w_paperInfo = m_report.getPaperInfo(); m_paint.setGridHeight( pSetSizePics(CSReportPaint.cGlobals.getRectFromPaperSize( m_report.getPaperInfo(), w_paperInfo.getPaperSize(), w_paperInfo.getOrientation()).Height)); m_paint.initGrid(m_picReport.CreateGraphics(), m_typeGrid); if (m_report.getName() != "") { m_editorTab.Text = m_report.getPath() + m_report.getName(); } cReportSection sec = null; for (int _i = 0; _i < m_report.getHeaders().count(); _i++) { sec = m_report.getHeaders().item(_i); sec.setKeyPaint(paintSection(sec.getAspect(), sec.getKey(), sec.getTypeSection(), sec.getName(), false)); paintSec = m_paint.getPaintSections().item(sec.getKeyPaint()); paintSec.setHeightSec(sec.getAspect().getHeight()); pAddPaintSetcionForSecLn(sec, csRptTypeSection.C_KEY_SECLN_HEADER); } for (int _i = 0; _i < m_report.getGroupsHeaders().count(); _i++) { sec = m_report.getGroupsHeaders().item(_i); sec.setKeyPaint(paintSection(sec.getAspect(), sec.getKey(), sec.getTypeSection(), sec.getName(), false)); paintSec = m_paint.getPaintSections().item(sec.getKeyPaint()); paintSec.setHeightSec(sec.getAspect().getHeight()); pAddPaintSetcionForSecLn(sec, csRptTypeSection.C_KEY_SECLN_GROUPH); } for (int _i = 0; _i < m_report.getDetails().count(); _i++) { sec = m_report.getDetails().item(_i); sec.setKeyPaint(paintSection(sec.getAspect(), sec.getKey(), sec.getTypeSection(), sec.getName(), false)); paintSec = m_paint.getPaintSections().item(sec.getKeyPaint()); paintSec.setHeightSec(sec.getAspect().getHeight()); pAddPaintSetcionForSecLn(sec, csRptTypeSection.C_KEY_SECLN_DETAIL); } for (int _i = 0; _i < m_report.getGroupsFooters().count(); _i++) { sec = m_report.getGroupsFooters().item(_i); sec.setKeyPaint(paintSection(sec.getAspect(), sec.getKey(), sec.getTypeSection(), sec.getName(), false)); paintSec = m_paint.getPaintSections().item(sec.getKeyPaint()); paintSec.setHeightSec(sec.getAspect().getHeight()); pAddPaintSetcionForSecLn(sec, csRptTypeSection.C_KEY_SECLN_GROUPF); } for (int _i = 0; _i < m_report.getFooters().count(); _i++) { sec = m_report.getFooters().item(_i); sec.setKeyPaint(paintSection(sec.getAspect(), sec.getKey(), sec.getTypeSection(), sec.getName(), false)); paintSec = m_paint.getPaintSections().item(sec.getKeyPaint()); paintSec.setHeightSec(sec.getAspect().getHeight()); pAddPaintSetcionForSecLn(sec, csRptTypeSection.C_KEY_SECLN_FOOTER); } CSReportPaint.csRptPaintObjType paintType; for (int _i = 0; _i < m_report.getControls().count(); _i++) { cReportControl rptCtrl = m_report.getControls().item(_i); refreshNextNameCtrl(rptCtrl.getName()); cReportAspect ctrlAspect = rptCtrl.getLabel().getAspect(); if (rptCtrl.getControlType() == csRptControlType.CSRPTCTIMAGE || rptCtrl.getControlType() == csRptControlType.CSRPTCTCHART) { paintType = CSReportPaint.csRptPaintObjType.CSRPTPAINTOBJIMAGE; } else { paintType = CSReportPaint.csRptPaintObjType.CSRPTPAINTOBJBOX; } CSReportPaint.cReportPaintObject paintObj = m_paint.getNewObject(paintType); // for old reports // ctrlAspect.setTransparent(ctrlAspect.getBackColor() == Color.White.ToArgb()); paintObj.setImage(rptCtrl.getImage().getImage()); cReportAspect w_aspect = paintObj.getAspect(); w_aspect.setLeft(ctrlAspect.getLeft()); w_aspect.setTop(ctrlAspect.getTop()); w_aspect.setWidth(ctrlAspect.getWidth()); w_aspect.setHeight(ctrlAspect.getHeight()); w_aspect.setBackColor(ctrlAspect.getBackColor()); w_aspect.setTransparent(ctrlAspect.getTransparent()); w_aspect.setAlign(ctrlAspect.getAlign()); w_aspect.setWordWrap(ctrlAspect.getWordWrap()); if (ctrlAspect.getBorderType() == csReportBorderType.CSRPTBSNONE) { w_aspect.setBorderColor(Color.Black.ToArgb()); w_aspect.setBorderWidth(1); w_aspect.setBorderRounded(false); w_aspect.setBorderType(csReportBorderType.CSRPTBSFIXED); } else { w_aspect.setBorderType(ctrlAspect.getBorderType()); w_aspect.setBorderColor(ctrlAspect.getBorderColor()); w_aspect.setBorderColor3d(ctrlAspect.getBorderColor3d()); w_aspect.setBorderColor3dShadow(ctrlAspect.getBorderColor3dShadow()); w_aspect.setBorderRounded(ctrlAspect.getBorderRounded()); w_aspect.setBorderWidth(ctrlAspect.getBorderWidth()); } switch (rptCtrl.getSectionLine().getTypeSection()) { case csRptTypeSection.CSRPTTPSCFOOTER: case csRptTypeSection.CSRPTTPMAINSECTIONFOOTER: w_aspect.setOffset(m_offSet); break; } cReportFont w_font = w_aspect.getFont(); w_font.setName(ctrlAspect.getFont().getName()); w_font.setForeColor(ctrlAspect.getFont().getForeColor()); w_font.setSize(ctrlAspect.getFont().getSize()); w_font.setBold(ctrlAspect.getFont().getBold()); w_font.setItalic(ctrlAspect.getFont().getItalic()); w_font.setUnderline(ctrlAspect.getFont().getUnderline()); w_font.setStrike(ctrlAspect.getFont().getStrike()); paintObj.setText(rptCtrl.getLabel().getText()); paintObj.setRptType(csRptTypeSection.CONTROL); paintObj.setTag(rptCtrl.getKey()); rptCtrl.setKeyPaint(paintObj.getKey()); } m_dataHasChanged = false; m_paint.createPicture(m_picReport.CreateGraphics()); m_picRule.Refresh(); }
private void m_picReport_MouseDown(MouseButtons button, bool ctrlKey, int x, int y) { try { String sKey = ""; bool bClearSelected = false; String lastKeyMoving = ""; String lastKeyObj = ""; // to avoid reentrancy if (m_opening) { return; } m_inMouseDown = true; if (m_draging) { addControlEnd(x, y); endDraging(); } endEditText(false); bClearSelected = pClearSelected(button, ctrlKey, x, y); if (button == MouseButtons.Left) { lastKeyObj = m_keyObj; m_keyObj = ""; sKey = m_keyMoving != "" ? m_keyMoving : m_keySizing; // to force focus in the header if (sKey == "") { m_paint.pointIsInObject(x, y, ref sKey); if (sKey != "") { CSReportPaint.cReportPaintObject po = m_paint.getPaintObject(sKey); lastKeyMoving = m_keyMoving; m_keyMoving = sKey; switch (po.getTag()) { case cGlobals.C_KEY_DETAIL: case cGlobals.C_KEY_FOOTER: case cGlobals.C_KEY_HEADER: // only if no controls are selected // if (ctrlKey) { if (m_vSelectedKeys.Length > 0) return; if (m_vSelectedKeys[0].Length > 0) return; m_keyMoving = lastKeyMoving; m_keyObj = lastKeyObj; return; } m_moveType = csRptEditorMoveType.CSRPTEDMOVTVERTICAL; m_picReport.Cursor = Cursors.SizeNS; break; default: if (po.getRptType() == csRptTypeSection.CSRPTTPSCDETAIL || po.getRptType() == csRptTypeSection.CSRPTTPSCHEADER || po.getRptType() == csRptTypeSection.GROUP_SECTION_HEADER || po.getRptType() == csRptTypeSection.GROUP_SECTION_FOOTER || po.getRptType() == csRptTypeSection.CSRPTTPSCFOOTER) { // only if no controls are selected // if (ctrlKey) { if (m_vSelectedKeys.Length > 0) return; if (m_vSelectedKeys[0].Length > 0) return; m_keyMoving = lastKeyMoving; m_keyObj = lastKeyObj; return; } m_picReport.Cursor = Cursors.SizeNS; m_moveType = csRptEditorMoveType.CSRPTEDMOVTVERTICAL; } else if (po.getRptType() == csRptTypeSection.C_KEY_SECLN_HEADER || po.getRptType() == csRptTypeSection.C_KEY_SECLN_DETAIL || po.getRptType() == csRptTypeSection.C_KEY_SECLN_FOOTER || po.getRptType() == csRptTypeSection.C_KEY_SECLN_GROUPH || po.getRptType() == csRptTypeSection.C_KEY_SECLN_GROUPF) { // only if no controls are selected // if (ctrlKey) { if (m_vSelectedKeys.Length > 0) return; if (m_vSelectedKeys[0].Length > 0) return; m_keyMoving = lastKeyMoving; m_keyObj = lastKeyObj; return; } m_picReport.Cursor = Cursors.SizeNS; m_moveType = csRptEditorMoveType.CSRPTEDMOVTVERTICAL; } else { m_moveType = csRptEditorMoveType.CSRPTEDMOVTALL; m_picReport.Cursor = Cursors.SizeAll; } break; } } } bool bWasRemoved = false; pAddToSelected(m_keyMoving, ctrlKey, out bWasRemoved); if (bWasRemoved) { sKey = ""; } if (sKey != "") { cReportAspect aspect = m_paint.getPaintObject(sKey).getAspect(); m_offX = x - aspect.getLeft(); m_offY = y - (aspect.getTop() - aspect.getOffset()); } m_keyFocus = sKey; m_keyObj = sKey; m_paint.setFocus(m_keyFocus, m_graphic, bClearSelected); } else if (button == MouseButtons.Right) { m_keySizing = ""; m_keyMoving = ""; m_keyObj = ""; if (m_paint.pointIsInObject(x, y, ref sKey)) { m_keyObj = sKey; bClearSelected = pSetSelectForRightBttn(); m_keyFocus = sKey; m_paint.setFocus(m_keyFocus, m_graphic, bClearSelected); CSReportPaint.cReportPaintObject po = m_paint.getPaintObject(sKey); if (m_paint.paintObjIsSection(sKey)) { bool noDelete = false; switch (po.getTag()) { // this sections can not be moved case cGlobals.C_KEY_HEADER: case cGlobals.C_KEY_DETAIL: case cGlobals.C_KEY_FOOTER: noDelete = true; break; default: noDelete = false; break; } bool isGroup = false; bool isSecLn = false; pGetSection(out isGroup, out isSecLn); if (isSecLn) { noDelete = true; } showPopMenuSection(noDelete, isGroup); } else { showPopMenuControl(true); } } else { showPopMenuControl(false); } } cGlobals.setEditAlignTextState(m_vSelectedKeys.Length); cGlobals.setEditAlignCtlState(m_vSelectedKeys.Length > 1); pSetEditAlignValue(); pSetFontBoldValue(); } catch (Exception ex) { cError.mngError(ex, "m_picReport_MouseDown", C_MODULE, ""); m_inMouseDown = false; } }
private void m_picReport_MouseMove( MouseButtons button, int shift, float x, float y) { String sKey = ""; csRptPaintRegionType rgnTp = csRptPaintRegionType.CRPTPNTRGNTYPEBODY; if (m_draging) { return; } if (m_inMouseDown) { return; } if (button == MouseButtons.Left) { m_paint.beginMove(); if (m_keyMoving != "") { switch (m_moveType) { case csRptEditorMoveType.CSRPTEDMOVTALL: pShowMoveAll(x, y); break; case csRptEditorMoveType.CSRPTEDMOVTHORIZONTAL: m_paint.moveHorizontal(m_keyMoving, x, m_graphic); break; case csRptEditorMoveType.CSRPTEDMOVTVERTICAL: m_paint.moveVertical(m_keyMoving, y, m_graphic); break; } m_moving = true; } else if (m_keySizing != "") { switch (m_moveType) { case csRptEditorMoveType.CSRPTEDMOVDOWN: m_paint.resize(m_graphic, m_keySizing, cGlobals.C_NO_CHANGE, cGlobals.C_NO_CHANGE, cGlobals.C_NO_CHANGE, y); break; case csRptEditorMoveType.CSRPTEDMOVLEFT: m_paint.resize(m_graphic, m_keySizing, x, cGlobals.C_NO_CHANGE, cGlobals.C_NO_CHANGE, cGlobals.C_NO_CHANGE); break; case csRptEditorMoveType.CSRPTEDMOVRIGHT: m_paint.resize(m_graphic, m_keySizing, cGlobals.C_NO_CHANGE, cGlobals.C_NO_CHANGE, x, cGlobals.C_NO_CHANGE); break; case csRptEditorMoveType.CSRPTEDMOVUP: m_paint.resize(m_graphic, m_keySizing, cGlobals.C_NO_CHANGE, y, cGlobals.C_NO_CHANGE, cGlobals.C_NO_CHANGE); break; case csRptEditorMoveType.CSRPTEDMOVLEFTDOWN: m_paint.resize(m_graphic, m_keySizing, x, cGlobals.C_NO_CHANGE, cGlobals.C_NO_CHANGE, y); break; case csRptEditorMoveType.CSRPTEDMOVLEFTUP: m_paint.resize(m_graphic, m_keySizing, x, y, cGlobals.C_NO_CHANGE, cGlobals.C_NO_CHANGE); break; case csRptEditorMoveType.CSRPTEDMOVRIGHTDOWN: m_paint.resize(m_graphic, m_keySizing, cGlobals.C_NO_CHANGE, cGlobals.C_NO_CHANGE, x, y); break; case csRptEditorMoveType.CSRPTEDMOVRIGHTUP: m_paint.resize(m_graphic, m_keySizing, cGlobals.C_NO_CHANGE, y, x, cGlobals.C_NO_CHANGE); break; } m_moving = true; } else { m_moving = false; } } else { if (m_keyFocus != "") { sKey = m_keyFocus; if (m_paint.pointIsInThisObject(x, y, ref m_keyFocus, ref rgnTp)) { CSReportPaint.cReportPaintObject po = m_paint.getPaintObject(sKey); cReportControl ctrl = m_report.getControls().item(po.getTag()); pSetSbPnlCtrl( ctrl.getName(), ctrl.getControlType(), ctrl.getFormulaHide().getText(), ctrl.getFormulaValue().getText(), ctrl.getHasFormulaHide(), ctrl.getHasFormulaValue(), ctrl.getField().getName()); if (po.getPaintType() == csRptPaintObjType.CSRPTPAINTOBJLINE) { m_keyMoving = sKey; m_keySizing = ""; m_picReport.Cursor = Cursors.SizeNS; } else { switch (po.getTag()) { case cGlobals.C_KEY_DETAIL: case cGlobals.C_KEY_FOOTER: case cGlobals.C_KEY_HEADER: m_keyMoving = sKey; m_keySizing = ""; m_picReport.Cursor = Cursors.SizeNS; m_moveType = csRptEditorMoveType.CSRPTEDMOVTVERTICAL; break; default: if (po.getRptType() == csRptTypeSection.CSRPTTPSCDETAIL || po.getRptType() == csRptTypeSection.CSRPTTPSCHEADER || po.getRptType() == csRptTypeSection.GROUP_SECTION_HEADER || po.getRptType() == csRptTypeSection.GROUP_SECTION_FOOTER || po.getRptType() == csRptTypeSection.CSRPTTPSCFOOTER) { m_keyMoving = sKey; m_keySizing = ""; m_picReport.Cursor = Cursors.SizeNS; m_moveType = csRptEditorMoveType.CSRPTEDMOVTVERTICAL; } else { switch (rgnTp) { case csRptPaintRegionType.CRPTPNTRGNTYPEBODY: m_picReport.Cursor = Cursors.SizeAll; m_keyMoving = sKey; m_keySizing = ""; m_moveType = csRptEditorMoveType.CSRPTEDMOVTALL; break; case csRptPaintRegionType.CRPTPNTRGNTYPEDOWN: m_picReport.Cursor = Cursors.SizeNS; m_keySizing = sKey; m_keyMoving = ""; m_moveType = csRptEditorMoveType.CSRPTEDMOVDOWN; break; case csRptPaintRegionType.CRPTPNTRGNTYPEUP: m_picReport.Cursor = Cursors.SizeNS; m_keySizing = sKey; m_keyMoving = ""; m_moveType = csRptEditorMoveType.CSRPTEDMOVUP; break; case csRptPaintRegionType.CRPTPNTRGNTYPELEFT: m_picReport.Cursor = Cursors.SizeWE; m_keySizing = sKey; m_keyMoving = ""; m_moveType = csRptEditorMoveType.CSRPTEDMOVLEFT; break; case csRptPaintRegionType.CRPTPNTRGNTYPERIGHT: m_picReport.Cursor = Cursors.SizeWE; m_keySizing = sKey; m_keyMoving = ""; m_moveType = csRptEditorMoveType.CSRPTEDMOVRIGHT; break; case csRptPaintRegionType.CRPTPNTRGNTYPELEFTDOWN: m_picReport.Cursor = Cursors.SizeNESW; m_keySizing = sKey; m_keyMoving = ""; m_moveType = csRptEditorMoveType.CSRPTEDMOVLEFTDOWN; break; case csRptPaintRegionType.CRPTPNTRGNTYPERIGHTUP: m_picReport.Cursor = Cursors.SizeNESW; m_keySizing = sKey; m_keyMoving = ""; m_moveType = csRptEditorMoveType.CSRPTEDMOVRIGHTUP; break; case csRptPaintRegionType.CRPTPNTRGNTYPERIGHTDOWN: m_picReport.Cursor = Cursors.SizeNWSE; m_keySizing = sKey; m_keyMoving = ""; m_moveType = csRptEditorMoveType.CSRPTEDMOVRIGHTDOWN; break; case csRptPaintRegionType.CRPTPNTRGNTYPELEFTUP: m_picReport.Cursor = Cursors.SizeNWSE; m_keySizing = sKey; m_keyMoving = ""; m_moveType = csRptEditorMoveType.CSRPTEDMOVLEFTUP; break; default: m_keySizing = ""; m_keyMoving = ""; break; } } break; } } } else { pSetSbPnlCtrl(""); m_picReport.Cursor = Cursors.Default; m_keySizing = ""; m_keyMoving = ""; } } if (m_paint.pointIsInObject(x, y, ref sKey, ref rgnTp)) { CSReportPaint.cReportPaintObject po = m_paint.getPaintObject(sKey); if (po.getRptType() == csRptTypeSection.CONTROL) { cReportControl rptCtrl = null; rptCtrl = m_report.getControls().item(po.getTag()); if (rptCtrl != null) { pSetSbPnlCtrl(rptCtrl.getName(), rptCtrl.getControlType(), rptCtrl.getFormulaHide().getText(), rptCtrl.getFormulaValue().getText(), rptCtrl.getHasFormulaHide(), rptCtrl.getHasFormulaValue(), rptCtrl.getField().getName()); } } else { pSetSbPnlCtrl(""); } } else { pSetSbPnlCtrl(""); } } }
private void pSetMovingFromKeyboard(float x, float y) { m_keyMoving = m_keyFocus; CSReportPaint.cReportPaintObject po = m_paint.getPaintObject(m_keyMoving); switch (po.getTag()) { case cGlobals.C_KEY_DETAIL: case cGlobals.C_KEY_FOOTER: case cGlobals.C_KEY_HEADER: m_moveType = csRptEditorMoveType.CSRPTEDMOVTVERTICAL; m_picReport.Cursor = Cursors.SizeNS; break; default: if (po.getRptType() == csRptTypeSection.CSRPTTPSCDETAIL || po.getRptType() == csRptTypeSection.CSRPTTPSCHEADER || po.getRptType() == csRptTypeSection.GROUP_SECTION_HEADER || po.getRptType() == csRptTypeSection.GROUP_SECTION_FOOTER || po.getRptType() == csRptTypeSection.CSRPTTPSCFOOTER) { m_picReport.Cursor = Cursors.SizeNS; m_moveType = csRptEditorMoveType.CSRPTEDMOVTVERTICAL; } else if (po.getRptType() == csRptTypeSection.C_KEY_SECLN_HEADER || po.getRptType() == csRptTypeSection.C_KEY_SECLN_DETAIL || po.getRptType() == csRptTypeSection.C_KEY_SECLN_FOOTER || po.getRptType() == csRptTypeSection.C_KEY_SECLN_GROUPH || po.getRptType() == csRptTypeSection.C_KEY_SECLN_GROUPF) { m_picReport.Cursor = Cursors.SizeNS; m_moveType = csRptEditorMoveType.CSRPTEDMOVTVERTICAL; } else { m_moveType = csRptEditorMoveType.CSRPTEDMOVTALL; m_picReport.Cursor = Cursors.SizeNS; } break; } cReportAspect aspect = m_paint.getPaintObject(m_keyMoving).getAspect(); m_offX = x - aspect.getLeft(); m_offY = y - (aspect.getTop() - aspect.getOffset()); m_keyObj = m_keyMoving; cGlobals.setEditAlignTextState(m_vSelectedKeys.Length); cGlobals.setEditAlignCtlState(m_vSelectedKeys.Length > 1); pSetEditAlignValue(); pSetFontBoldValue(); }