public void controlsAlign(CSReportGlobals.csECtlAlignConst align) {
int i = 0;
CSReportPaint.cReportPaintObject paintObject = null;
cReportControl rptCtrl = null;
float top = 0;
float left = 0;
float newTop = 0;
float newLeft = 0;
float height = 0;
float width = 0;
cReportAspect aspect;
switch (align) {
case csECtlAlignConst.csECtlAlignHeight:
case csECtlAlignConst.csECtlAlignWidth:
aspect = m_paint.getPaintObject(m_vSelectedKeys[1]).getAspect();
height = aspect.getHeight();
width = aspect.getWidth();
break;
case csECtlAlignConst.csECtlAlignVertical:
case csECtlAlignConst.csECtlAlignHorizontal:
aspect = m_paint.getPaintObject(m_vSelectedKeys[1]).getAspect();
newTop = aspect.getTop();
newLeft = aspect.getLeft();
break;
default:
switch (align) {
case csECtlAlignConst.csECtlAlignLeft:
newLeft = 100000;
break;
case csECtlAlignConst.csECtlAlignRight:
newLeft = 0;
break;
case csECtlAlignConst.csECtlAlignTop:
newTop = 100000;
break;
case csECtlAlignConst.csECtlAlignBottom:
newTop = 0;
break;
}
for (i = 1; i <= m_vSelectedKeys.Length; i++) {
aspect = m_paint.getPaintObject(m_vSelectedKeys[i]).getAspect();
top = aspect.getTop();
left = aspect.getLeft();
switch (align) {
case csECtlAlignConst.csECtlAlignLeft:
if (left < newLeft) { newLeft = left; }
break;
case csECtlAlignConst.csECtlAlignRight:
if (left > newLeft) { newLeft = left; }
break;
case csECtlAlignConst.csECtlAlignTop:
if (top < newTop) { newTop = top; }
break;
case csECtlAlignConst.csECtlAlignBottom:
if (top > newTop) { newTop = top; }
break;
}
}
break;
}
for (i = 1; i <= m_vSelectedKeys.Length; i++) {
paintObject = m_paint.getPaintObject(m_vSelectedKeys[i]);
rptCtrl = m_report.getControls().item(paintObject.getTag());
switch (align) {
case csECtlAlignConst.csECtlAlignHeight:
rptCtrl.getLabel().getAspect().setHeight(height);
paintObject.getAspect().setHeight(height);
break;
case csECtlAlignConst.csECtlAlignWidth:
rptCtrl.getLabel().getAspect().setWidth(width);
paintObject.getAspect().setWidth(width);
break;
case csECtlAlignConst.csECtlAlignLeft:
case csECtlAlignConst.csECtlAlignRight:
case csECtlAlignConst.csECtlAlignHorizontal:
rptCtrl.getLabel().getAspect().setLeft(newLeft);
paintObject.getAspect().setLeft(newLeft);
break;
case csECtlAlignConst.csECtlAlignTop:
case csECtlAlignConst.csECtlAlignBottom:
case csECtlAlignConst.csECtlAlignVertical:
rptCtrl.getLabel().getAspect().setTop(newTop);
paintObject.getAspect().setTop(newTop);
break;
}
}
m_dataHasChanged = true;
refreshAll();
}