如何删除或隐藏Crystal Report Viewer(C#)中的主选项卡部分。
答案 0 :(得分:7)
奥米德的回答是正确的,但是在设置了查看者的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;
}
}
}
}
}
答案 1 :(得分:3)
感谢。
在VB中看起来应该是这样的:
For Each c1 As Control In CrystalReportViewer1.Controls
If c1.GetType Is GetType(CrystalDecisions.Windows.Forms.PageView) Then
Dim pv As CrystalDecisions.Windows.Forms.PageView = c1
For Each c2 As Control In pv.Controls
If c2.GetType Is GetType(TabControl) Then
Dim tc As TabControl = c2
tc.ItemSize = New Size(0, 1)
tc.SizeMode = TabSizeMode.Fixed
End If
Next
End If
Next
答案 2 :(得分:1)
在页面中引用jquery.js
并粘贴此脚本:
<script type="text/javascript">
$(document).ready(function () {
$(".hideableFrame").hide();
});
我发现“主要标签”位于<tr>
class="hideableFrame"
<tr class="hideableFrame" valign="bottom" height="28" style="display: table-row;">
<td>
<img width="5" height="5"
...
我无法在css
文件中工作,因为style:display
写在元素上,因此我编写了一个脚本,用于更改标记为hideableFrame
的项目的可见性。
注意:有4个-USELESS-元素class="hideableFrame"
;这个脚本将隐藏所有这些。
答案 3 :(得分:1)
我尝试了Emanuele Greco的解决方案并且它可以工作,但有时候不可能在代码中添加一个引用到jquery。 在您的网页中试试这个
<CR:CrystalReportViewer ID="CrystalReportViewer1"
runat="server"
CssClass="Report"
HasCrystalLogo="False"
HasSearchButton="False"
HasToggleGroupTreeButton="False"
HasZoomFactorList="False"
Height="100%" Width="100%"
meta:resourcekey="CrystalReportViewer1Resource1"
EnableDrillDown="False"
ReuseParameterValuesOnRefresh="True"
EnableToolTips="False" ToolPanelView="None" HasDrilldownTabs="False"
HasDrillUpButton="False" />
答案 4 :(得分:0)
foreach (Control control in crystalReportViewer1.Controls)
{
if (control is CrystalDecisions.Windows.Forms.PageView)
{
TabControl tab = (TabControl)(CrystalDecisions.Windows.Forms.PageView)control).Controls[0];
tab.ItemSize = new Size(0, 1);
tab.SizeMode = TabSizeMode.Fixed;
tab.Appearance = TabAppearance.Buttons;
}
}
答案 5 :(得分:0)
在 CrystalReportViewer 控件中设置 HasDrilldownTabs="false"
答案 6 :(得分:-1)
crystalReportViewer1.DisplayStatusBar = false;