I can't seem to find much help on printing FlowLayoutPanels in C#
I basically have a FlowLayoutPanel with multiple panels inside it. Each panel has textboxes and labels on it.
I want to print the entire contents of the flowlayoutpanel regardless of whether you need to scroll down. and that have many pages. I have tried the below :
private void doc_PrintPage(object sender, PrintPageEventArgs e)
{
Bitmap bmp = new Bitmap(flowlayoutpanel.Width, flowlayoutpanel.Height,
flowlayoutpanel.CreateGraphics());
flowlayoutpanel.DrawToBitmap(bmp, new Rectangle(0, 0, flowlayoutpanel.Width, flowlayoutpanel.Height));
RectangleF bounds = e.PageSettings.PrintableArea;
float factor = ((float)bmp.Height / (float)bmp.Width);
e.Graphics.DrawImage(bmp, bounds.Left, bounds.Top, bounds.Width, factor * bounds.Width);
}
private void btnsave_Click(object sender, EventArgs e)
{
PrintDocument doc = new PrintDocument();
doc.PrintPage += new PrintPageEventHandler(doc_PrintPage);
doc.Print();
}
this code print just some panels that when scrool is up but other panel from the button not printed.
Sorry for my english.