locked
How to Draw AjaxControlToolkit TabPanel to Bitmap RRS feed

  • Question

  • User-471962099 posted

    hi Members,

    I have ajax tab container that contains many tabs. I want to loop through each tab and draw the tab panel content to bitmap.

    This is my current codes:

    foreach (object obj in container.Controls)
                    {
                        if (obj is AjaxControlToolkit.TabPanel)
                        {
                            AjaxControlToolkit.TabPanel tabPanel = (AjaxControlToolkit.TabPanel)obj;
    
                            Bitmap m_Bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
    
                            Graphics graphics = Graphics.FromImage(m_Bitmap as System.Drawing.Image);
                            graphics.CopyFromScreen(25, 25, 25, 25, m_Bitmap.Size);
    
                            m_Bitmap.Save(@"C:\Users\user\Desktop\Project\Project1\Source Code\Project1\Image\" + tabPanel.HeaderText + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
                        }
                    }

    Now I am able to loop thorugh each tab panel in the tab container and screenshot the whole webpage, then save the bitmap image in Image folder. But I want to screenshot/bitmap just the tab panel content.

    Question: How to Draw AjaxControlToolkit TabPanel to Bitmap with my current codes?

    Please guide me on this, thanks.

    Tuesday, October 20, 2015 9:43 PM

Answers