自定义TooBar和预览报表的方法如下:
- private void Form1_Load(object sender, EventArgs e)
- {
- this.viewer1.ToolClick += new DataDynamics.ActiveReports.Toolbar.ToolClickEventHandler(viewer1_ToolClick);
- DataDynamics.ActiveReports.Toolbar.Button b = new DataDynamics.ActiveReports.Toolbar.Button();
- b.ButtonStyle = DataDynamics.ActiveReports.Toolbar.ButtonStyle.Text;
- b.Enabled = true;
- b.Id = 777;
- b.ImageIndex = 0;
- b.ToolTip = "点击我";
- b.Visible = true;
- b.Caption = "点击我";
- this.viewer1.Toolbar.Tools.Add(b);
- DataDynamics.ActiveReports.ActiveReport rpt = new DataDynamics.ActiveReports.ActiveReport();
- rpt.LoadLayout(@"ActiveReport1.rpx");
- rpt.Run();
- this.viewer1.Document = rpt.Document;
- }
- void viewer1_ToolClick(object sender, DataDynamics.ActiveReports.Toolbar.ToolClickEventArgs e)
- {
- switch (e.Tool.Id)
- {
- case 777:
- MessageBox.Show("我被点击了!!!");
- break;
- default:
- break;
- }
- }
复制代码 |