2012-02-06 3 views
1

XRTableCell의 실제 높이를 계산해야하는 보고서를 작성하고 있습니다. 나는 BeforePrint XRTableCell을 무시하려했지만 디자이너에서 사용 된 높이를보고합니다.XRTableCell 렌더링 높이 계산

렌더링 된 셀의 실제 크기는 어떻게 얻을 수 있습니까?

답변

0

BeforePrint 및 AfterPrint 이벤트는 실제 렌더링이 완료되기 전에 실행됩니다. Draw 이벤트에 연결하여 사용 된 치수를 기록 할 수 있지만이 정보는 유용하게 사용하기에는 너무 늦을 수 있습니다.

미리보기 표면이 변경되면 Draw 이벤트가 반복됩니다. 여백이 조정 된 경우

public partial class XtraReport1 : DevExpress.XtraReports.UI.XtraReport { 
    public XtraReport1() { 
     InitializeComponent(); 
    } 

    void xrTableCell1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { 
     // Called 1st. 
    } 

    void xrTableCell1_AfterPrint(object sender, EventArgs e) { 
     // Called 2nd. 
    }  

    float xrTableCell1_RenderHeight = 0; 
    void xrTableCell1_Draw(object sender, DrawEventArgs e) { 

     // Called 3rd. And repeated if the preview window is altered. (e.g. Margins moved) 
     XRTableCell cell = sender as XRTableCell; 
     xrTableCell1_RenderHeight = e.Bounds.Height; 
    }  
} 
관련 문제