CSReportEditor.cEditor.addControlEnd C# (CSharp) Метод

addControlEnd() приватный Метод

private addControlEnd ( float left, float top ) : bool
left float
top float
Результат bool
		private bool addControlEnd(float left, float top) {
            cReportControl ctrl = null;

            m_draging = false;

            if (m_controlType == csRptEditCtrlType.CSRPTEDITNONE) {
                return true;
            }

            m_dataHasChanged = true;

            int i = 0;
			float originalLeft = 0;
			float originalTop = 0;
            cReportControl copyCtrl = null;
            cReportControl movedCtrl = null;
			float firstCtrlLeft = 0;
			float offSet = 0;

            if (m_copyControls) {

                if (m_vCopyKeys.Length == 0) { return false; }

                originalLeft = left;
                originalTop = top;

                String keyPaint = m_vCopyKeys[m_vCopyKeys.Length - 1];
				String keyCtrl = m_paint.getPaintObjects().item(keyPaint).getTag();
				movedCtrl = m_report.getControls().item(keyCtrl);
                firstCtrlLeft = movedCtrl.getLabel().getAspect().getLeft();

                for (i = m_vCopyKeys.Length; i <= 1; i--) {

                    keyPaint = m_vCopyKeys[i];
					keyCtrl = m_paint.getPaintObjects().item(keyPaint).getTag();
					copyCtrl = m_report.getControls().item(keyCtrl);

                    // starting with the first control we move the left
                    // of every control if reach the right margin 
                    // move down a line and restart
                    //
                    offSet = pGetOffsetLeftFromControls(firstCtrlLeft, copyCtrl.getLabel().getAspect().getLeft());
                    left = originalLeft + offSet;

                    if (m_bCopyWithoutMoving) {

                        top = copyCtrl.getLabel().getAspect().getTop();
                        left = copyCtrl.getLabel().getAspect().getLeft();

                    }

                    if (left - 400 > m_picReport.Width) {
                        left = originalLeft + (offSet % originalLeft);
                        top += 100;
                    }

                    if (top > m_picReport.Height) {
                        top = m_picReport.Height - 100;
                    }

                    pAddControlEndAux(left, top, copyCtrl);

                }
                m_copyControls = false;

            } 
            else if (m_copyControlsFromOtherReport) {

                if (m_fmain.getReportCopySource() == null) { return false; }

                originalLeft = left;
                originalTop = top;

                cEditor editor = m_fmain.getReportCopySource();
                String keyPaint = editor.getVCopyKeys(editor.getVCopyKeysCount());
				String keyCtrl = editor.getPaint().getPaintObjects().item(keyPaint).getTag();
				movedCtrl = editor.getReport().getControls().item(keyCtrl);
                firstCtrlLeft = movedCtrl.getLabel().getAspect().getLeft();

                for (i = editor.getVCopyKeysCount(); i <= 1; i--) {

                    keyPaint = editor.getVCopyKeys(i);
					keyCtrl = editor.getPaint().getPaintObjects().item(keyPaint).getTag();
					copyCtrl = editor.getReport().getControls().item(keyCtrl);

                    // starting with the first control we move the left
                    // of every control if reach the right margin 
                    // move down a line and restart
                    //
                    offSet = pGetOffsetLeftFromControls(firstCtrlLeft, copyCtrl.getLabel().getAspect().getLeft());
                    left = originalLeft + offSet;

                    if (m_bCopyWithoutMoving) {

                        top = copyCtrl.getLabel().getAspect().getTop();
                        left = copyCtrl.getLabel().getAspect().getLeft();

                    }

                    if (left - 400 > m_picReport.Width) {
                        left = originalLeft + (offSet % originalLeft);
                        top = top + 100;
                    }

                    if (top > m_picReport.Height) {
                        top = m_picReport.Height - 100;
                    }

                    pAddControlEndAux(left, top, copyCtrl);
                }

                m_copyControlsFromOtherReport = false;

            } 
            else {
                pAddControlEndAux(left, top, null);
            }

            refreshBody();

            return true;
        }
cEditor