Click here to Skip to main content
11,483,586 members (68,822 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET WinForm export
Hi

I have large content inside scrollable panel in windows form and i want to export all the content inside that panel to image .currently i am using below code but it saves only active form data.please help to save all the content.

this.treePanel.Dock = System.Windows.Forms.DockStyle.None;
                this.treePanel.Refresh();
 
                Bitmap bmp = new Bitmap(treePanel.Width, treePanel.Height);
                Rectangle rect = new Rectangle(0, 0, treePanel.Width, treePanel.Height);
                this.treePanel.DrawToBitmap(bmp, rect);
 
                this.treePanel.Dock = System.Windows.Forms.DockStyle.Fill;
                SaveFileDialog svDailog = new SaveFileDialog();
                svDailog.Filter = "JPEG Images (*.jpg,*.jpeg)|*.jpg;*.jpeg|Gif Images (*.gif)*.gif|Bitmaps (*.bmp)*.bmp";
                svDailog.FilterIndex = 1;
                DialogResult dr = svDailog.ShowDialog();
                if (dr.Equals(DialogResult.OK))
                {
                    string _filename = svDailog.FileName;
                    bmp.Save(_filename);
                 }

Please help....

Regards,
Nanju
Posted 4-Jul-12 4:07am
Edited 4-Jul-12 4:10am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 250
1 Frankie-C 175
2 Raje_ 155
3 OriginalGriff 152
4 Abhipal Singh 108
0 Sergey Alexandrovich Kryukov 8,489
1 OriginalGriff 7,943
2 Sascha Lefèvre 3,114
3 Maciej Los 2,581
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 4 Jul 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100