ReportViewer - 修改工具栏? [英] ReportViewer - modify toolbar?

查看:58
本文介绍了ReportViewer - 修改工具栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人对如何修改 WinForms 版本的 ReportViewer 工具栏的工具栏有好的想法?也就是说,我想删除一些按钮和变量,但看起来解决方案是创建一个全新的工具栏,而不是修改现有的工具栏.

Do anyone have good ideas of how to modify the toolbar for the WinForms version of the ReportViewer Toolbar? That is, I want to remove some buttons and varius, but it looks like the solution is to create a brand new toolbar instead of modifying the one that is there.

就像,我不得不删除导出到 excel,并这样做:

Like, I had to remove export to excel, and did it this way:

  // Disable excel export
  foreach (RenderingExtension extension in lr.ListRenderingExtensions()) {
    if (extension.Name == "Excel") {
      //extension.Visible = false; // Property is readonly...
      FieldInfo fi = extension.GetType().GetField("m_isVisible", BindingFlags.Instance | BindingFlags.NonPublic);
      fi.SetValue(extension, false);
    }
  }

如果你问我有点棘手..对于移除工具栏按钮,一种可能的方法是遍历 ReportViewer 中的 Control 数组,并将按钮的 Visible 属性更改为隐藏,但它一直被重置,因此这不是一个好方法.

A bit trickysh if you ask me.. For removing toolbarbuttons, an possible way was to iterate through the Control array inside the ReportViewer and change the Visible property for the buttons to hide, but it gets reset all the time, so it is not an good way..

顺便说一句,MS 什么时候推出新版本?

WHEN do MS come with an new version btw?

推荐答案

有很多属性可以设置您希望看到哪些按钮.

There are a lot of properties to set which buttons would you like to see.

例如 ShowBackButton, ShowExportButton, ShowFindControls 等.在 帮助帮助,都以Show"开头.

For example ShowBackButton, ShowExportButton, ShowFindControls, and so on. Check them in the help, all starts with "Show".

但是您说得对,您不能添加新按钮.您必须创建自己的工具栏才能执行此操作.

But you are right, you cannot add new buttons. You have to create your own toolbar in order to do this.

你说的新版本是什么意思?已经有一个 2008 SP1 版本.

What do you mean about new version? There is already a 2008 SP1 version of it.

这篇关于ReportViewer - 修改工具栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆