gpt4 book ai didi

c# - 如何删除 Crystal Report Viewer 中的主选项卡?

转载 作者:太空狗 更新时间:2023-10-30 00:17:42 25 4
gpt4 key购买 nike

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

最佳答案

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;
}
}
}
}
}

关于c# - 如何删除 Crystal Report Viewer 中的主选项卡?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/561586/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com