hi all,
i try to loop through each tab panel in Ajax tab container, then draw the tab panel to bitmap, and save the image. But there's a problem faced here
(Please See: http://i.stack.imgur.com/Mgws1.png[
^].
I was unable to set tab panel's client size, client rectangle and draw tab panel to bitmap.
This is my codes to bitmap tab panel in tab container:
foreach (object obj in container.Controls)
{
if (obj is AjaxControlToolkit.TabPanel)
{
AjaxControlToolkit.TabPanel tabPanel = (AjaxControlToolkit.TabPanel)obj;
using (Bitmap bmp = new Bitmap(tabPanel.ClientSize.Width, tabPanel.ClientSize.Height))
{
tabPanel.DrawToBitmap(bmp, tabPanel.ClientRectangle);
bmp.Save(CapturedFilePath + tabPanel.Name + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
This is my code to create tab and tab container dynamically in C#:
AjaxControlToolkit.TabContainer container = new AjaxControlToolkit.TabContainer();
container.ID = "TabContainer";
container.EnableViewState = false;
container.Tabs.Clear();
container.Height = Unit.Pixel(1000);
container.Width = Unit.Percentage(100);
if (Listbox1.SelectedValue == "Select All")
{
foreach (ListItem item in Listbox1.Items)
{
if (item.Text == "Select All")
{
continue;
}
AjaxControlToolkit.TabPanel panel = new AjaxControlToolkit.TabPanel();
panel.HeaderText += item.Text;
container.Tabs.Add(panel);
Question: How to Bitmap Tab Panel From Ajax Tab Container Using C#?
Appreciate if someone could guide me on this, thanks!