Page 1 of 1

Add a button in preview form

Posted: Thu Nov 01, 2007 6:16 pm
by Fabio Pagano
Scenario: i iterate through some reports, and to preview them i use your preview form (i don't use the control). Because i have the iteration, i need to make appear in the preview toolbar two buttons: "Previous report" and "Next report" and i need to catch their click events.

Is it possible?

Thanks.

Add a button in preview form

Posted: Fri Nov 02, 2007 5:11 am
by Edward
Yes, it is possible to add buttons to the toolbar of the StiPreviewControl of the custom StiPreviewForm. Please see the following code:

Code: Select all

            Stimulsoft.Report.Render.StiPreviewForm previewForm = new Stimulsoft.Report.Render.StiPreviewForm();
            Stimulsoft.Controls.StiButton myButton1 = new Stimulsoft.Controls.StiButton();
            Stimulsoft.Controls.StiButton myButton2 = new Stimulsoft.Controls.StiButton();
            myButton1.Text = "myButton1";
            myButton2.Text = "myButton2";
            myButton1.Click += new EventHandler(myButton1_Click);
            myButton2.Click += new EventHandler(myButton2_Click);
            
            myButton1.Dock = DockStyle.Left;
            myButton2.Dock = DockStyle.Left;

            previewForm.PreviewControl.ToolBar.Controls.Add(myButton2);
            previewForm.PreviewControl.ToolBar.Controls.Add(myButton1);
            previewForm.Show();

Thank you.