This is a migrated thread and some comments may be shown as answers.

reporting on a winforms 2005 app

1 Answer 112 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chris Yoker
Top achievements
Rank 1
Chris Yoker asked on 24 Dec 2006, 01:30 PM
hiya,

I have an app where the user needs to be able to "print" the data that is on the winform.
The data is mostly comboboxes and datagridViews.
Is this possible using the new reporting tool?

All I want to do is create a faithful reproduction (on a printed sheet), of what the user sees on the winform.

Any advice much appreciated,

cheers,

yogi

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 27 Dec 2006, 04:29 PM
Hi Chris,

Our reporting tool has its own design-time and does not rely on Windows Forms to render reports. However, the task that you are describing can be easily achieved using the DrawToBitmap method of the Control class (.NET 2.0). If you have a Form and and you hook to a Button's Click event, you can save the form to an image like this:

        private void btnPrint_Click(object sender, EventArgs e)
        {
            Bitmap image = new Bitmap(this.Width, this.Height);
            this.DrawToBitmap(image, new Rectangle(0, 0, this.Width, this.Height));
            image.Save(@"C:\form.bmp");
        }

Then you can print the bitmap which holds a "snapshot" of your form. Of course, you do not need to save the bitmap to a physical file, you can print it directly using the PrintDocument class. We hope that this will work for you.

 
All the best,
Rossen
the telerik team
Tags
General Discussions
Asked by
Chris Yoker
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or