如何删除Crystal Report Viewer中的Main选项卡?

4 c# crystal-reports

如何删除或隐藏Crystal Report Viewer(C#)中的主选项卡部分.

Jef*_*Roe 7

Omid的答案是正确的,但是在设置了查看器的ReportSource之后,你必须确保做到这一点.我下面的函数中的版本更加强大,并且使得更清晰,但我仍然不确定为什么对TabControl的ItemSize和SizeMode做一些魔术会使标签栏消失.

// This is a method of a Form with one of these:
//     CrystalDecisions.Windows.Forms.CrystalReportViewer
// This hides the tab control with the "Main Report" button.
public void hideTheTabControl()
{
    System.Diagnostics.Debug.Assert(
        crystalReportViewer1.ReportSource != null, 
        "you have to set the ReportSource first");

    foreach (Control c1 in crystalReportViewer1.Controls)
    {
        if (c1 is CrystalDecisions.Windows.Forms.PageView)
        {
            PageView pv = (PageView)c1;
            foreach (Control c2 in pv.Controls)
            {
                if (c2 is TabControl)
                {
                    TabControl tc = (TabControl)c2;
                    tc.ItemSize = new Size(0, 1);
                    tc.SizeMode = TabSizeMode.Fixed;
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)