문제

Winforms 응용 프로그램에서 Devexpress XtrarePorts를 사용하고 있지만 다른보고 도구에도 동일하게 적용될 수 있습니다.

보고서에서 연속으로 "렌더링 된"상태로 논리 자격을 수행하고 싶습니다. 구체적으로 바코드의 데이터를 사용할 수없는 경우 바코드를 숨기고 싶습니다.

현재 나는 다음을 수행하고 있습니다.

private void xrBarCode2_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
    var barcode = (XRBarCode)sender;

    if (barcode.Text.Trim() == "")
    {
        barcode.Visible = false;
        lblWarning.Visible = true;
    }
    else
    {
        barcode.Visible = true;
        lblWarning.Visible = false;
    }
}

그러나 그것은 단지 평범한 냄새가 나쁘다. 이 방법에서 현재 데이터 행에 액세스하고 객체의 "실제"속성에 대해 작업하고 싶지만 할 수는 없습니다. 다른 보고서 생성기의 일반적인 패턴은 무엇입니까? 올바른 이벤트를 사용하고 있습니까? 나는 시도했다 Detail_BeforePrint, 그러나 추가 정보는 없었습니다.

도움이 되었습니까?

해결책

getCurrentColumnValue ()와 함께 세부 사항을 사용하십시오.

private void Detail_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
    if (string.IsNullOrEmpty(GetCurrentColumnValue("BarcodeColumnName"))) {
        barcode.Visible = false;
        lblWarning.Visible = true;
    } else {
        barcode.Visible = true;
        lblWarning.Visible = false;
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top