加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – CrystalReportViewer打印

发布时间:2020-12-16 01:43:14 所属栏目:百科 来源:网络整理
导读:我想在ASP.NET C#中访问CrystalReportViewer的Print事件(当我单击CrystalReportViewer的Print按钮时),怎么样? 解决方法 像下面这样的东西应该有效.希望能帮助到你. public Form1() { InitializeComponent(); foreach (ToolStrip ts in crystalReportViewer1
我想在ASP.NET C#中访问CrystalReportViewer的Print事件(当我单击CrystalReportViewer的Print按钮时),怎么样?

解决方法

像下面这样的东西应该有效.希望能帮助到你.

public Form1()
    {
        InitializeComponent();
        foreach (ToolStrip ts in crystalReportViewer1.Controls.OfType<ToolStrip>())
        {
            foreach (ToolStripButton tsb in ts.Items.OfType<ToolStripButton>())
            {
                //hacky but should work. you can probably figure out a better method
                if (tsb.ToolTipText.ToLower().Contains("print"))
                {
                    //Adding a handler for our propose
                    tsb.Click += new EventHandler(printButton_Click);
                }
            }
        } 
    }

    private void printButton_Click(object sender,EventArgs e)
    {
        MessageBox.Show("Printed");
    }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读