Community discussion forum

I have to print the content of a panel.

Tags: a, content, how, of, panel, print, to India
  • 11 months ago
    Hii, I am new in this field. I have a lot of problem related to C#. My current problem is- I need to print the content of a panel. I tried it as following : private void btn_print_Click(object sender, EventArgs e) { Graphics myGraphics = this.panel1.CreateGraphics(); // MessageBox.Show("graphics created"); Size s = this.panel1.Size; Bitmap memoryImage = new Bitmap(s.Width, s.Height, myGraphics); Graphics memoryGraphics = Graphics.FromImage(memoryImage); memoryGraphics.CopyFromScreen(this.panel1.Location.X, this.panel1.Location.Y, 0, 0, s); if (System.IO.File.Exists(@"c:\PrintPage.jpg")) { System.IO.File.Delete(@"C:\PrintPage.jpg"); } memoryImage.Save(@"C:\PrintPage.jpg"); } but it is not working. It's just taking screen shot of present screen, but not printing its content only. Please help me. it wud be grate help. Regards Vijay

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

We'd love to hear what you think! Submit ideas or give us feedback